Part Number Hot Search : 
00110 N5311 M76HC 23A10 M3R63TCJ 1A105 AT24C04 T3331
Product Description
Full Text Search
 

To Download CY7C63231-PC Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  encore ? usb cy7c63221/31a cypress semiconductor corporation ? 3901 north first street  san jose , ca 95134  408-943-2600 document #: 38-08028 rev. *a revised october 21, 2002 1 cy7c63221a/31a encore? usb low-speed usb peripheral controller
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 2 of 49 table of contents 1.0 features ................................................................................................................. .................... 5 2.0 functional overview ...................................................................................................... ....... 6 2.1 encore usb - the new usb standard .................................................................................... 6 3.0 logic block diagram ...................................................................................................... ....... 7 4.0 pin configurations ....................................................................................................... .......... 7 5.0 pin assignments .......................................................................................................... ............. 7 6.0 programming model ........................................................................................................ ....... 8 6.1 program counter (pc) ..................................................................................................... .......... 8 6.2 8-bit accumulator (a) .................................................................................................... ............. 8 6.3 8-bit index register (x) ................................................................................................. ............. 8 6.4 8-bit program stack pointer (psp) ........................................................................................ .... 8 6.5 8-bit data stack pointer (dsp) ........................................................................................... ....... 9 6.6 address modes ............................................................................................................ .............. 9 6.6.1 data ................................................................................................................... ...............................9 6.6.2 direct ................................................................................................................. ............................... 9 6.6.3 indexed ................................................................................................................ ............................9 7.0 instruction set summary .................................................................................................. .10 8.0 memory organization ...................................................................................................... .... 11 8.1 program memory organization .............................................................................................. .. 11 8.2 data memory organization ................................................................................................. ..... 12 8.3 i/o register summary ..................................................................................................... ........ 13 9.0 clocking ................................................................................................................. ................... 14 9.1 internal/external oscillator operation ................................................................................... ... 15 9.2 external oscillator ...................................................................................................... .............. 15 10.0 reset ................................................................................................................... ...................... 16 10.1 low-voltage reset (lvr) ................................................................................................. ...... 16 10.2 brown-out reset (bor) ................................................................................................... ...... 16 10.3 watchdog reset (wdr) .................................................................................................... .... 17 11.0 suspend mode ............................................................................................................ ............ 17 11.1 clocking mode on wake-up from suspend ........................................................................... 18 11.2 wake-up timer ........................................................................................................... ........... 18 12.0 general purpose i/o ports ............................................................................................. 19 12.1 auxiliary input port .................................................................................................... ............. 21 13.0 usb serial interface engine (sie) ................................................................................. 22 13.1 usb enumeration ......................................................................................................... ......... 23 13.2 usb port status and control ............................................................................................. .... 23 14.0 usb device .............................................................................................................. ................. 25 14.1 usb address register .................................................................................................... ....... 25 14.2 usb control endpoint .................................................................................................... ........ 25 14.3 usb non-control endpoints ............................................................................................... ... 26 14.4 usb endpoint counter registers .......................................................................................... 27
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 3 of 49 15.0 usb regulator output .................................................................................................... .. 27 16.0 ps/2 operation .......................................................................................................... ............. 28 17.0 12-bit free-running timer ............................................................................................... .. 28 18.0 processor status and control register ............................................................... 29 19.0 interrupts .............................................................................................................. ................ 31 19.1 interrupt vectors ....................................................................................................... ............. 31 19.2 interrupt latency ....................................................................................................... ............. 32 19.3 interrupt sources ....................................................................................................... ............ 32 20.0 usb mode tables ......................................................................................................... ......... 36 21.0 register summary ........................................................................................................ ....... 41 22.0 absolute maximum ratings ............................................................................................. 42 23.0 dc characteristics ...................................................................................................... ...... 42 24.0 switching characteristics ............................................................................................. 44 25.0 ordering information .................................................................................................... ... 47 26.0 package diagrams ....................................................................................................... ...... 47
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 4 of 49 list of figures figure 8-1. program memory space with interrupt vector table ........................................................ 11 figure 9-1. clock oscillator on-chip circuit ................................................................................. ........ 14 figure 9-2. clock configuration register (address 0xf8) ................................................................... 14 figure 10-1. watchdog reset (wdr, address 0x26) .......................................................................... 17 figure 12-1. block diagram of gpio port (one pin shown) ................................................................. 19 figure 12-2. port 0 data (address 0x00) ...................................................................................... ....... 19 figure 12-3. port 1 data (address 0x01) ...................................................................................... ....... 20 figure 12-4. gpio port 0 mode0 register (address 0x0a) ................................................................. 20 figure 12-5. gpio port 0 mode1 register (address 0x0b) ................................................................. 20 figure 12-6. gpio port 1 mode0 register (address 0x0c) ................................................................ 20 figure 12-7. gpio port 1 mode1 register (address 0x0d) ................................................................ 21 figure 12-8. port 2 data register (address 0x02) ............................................................................. .22 figure 13-1. usb status and control register (address 0x1f) .......................................................... 23 figure 14-1. usb device address register (address 0x10) ............................................................... 25 figure 14-2. endpoint 0 mode register (address 0x12) ..................................................................... 25 figure 14-3. usb endpoint ep1 mode registers (address 0x14) ...................................................... 26 figure 14-4. endpoint 0 and 1 counter registers (addresses 0x11 and 0x13) .................................. 27 figure 16-1. diagram of usb - ps/2 system connections ................................................................. 28 figure 17-1. timer lsb register (address 0x24) ............................................................................... .29 figure 17-2. timer msb register (address 0x25) ............................................................................... 29 figure 17-3. timer block diagram ............................................................................................. .......... 29 figure 18-1. processor status and control register (address 0xff) ................................................. 29 figure 19-1. global interrupt enable register (address 0x20) ............................................................ 32 figure 19-2. endpoint interrupt enable register (address 0x21) ........................................................ 33 figure 19-3. interrupt controller logic block diagram ........................................................................ 34 figure 19-4. port 0 interrupt enable register (address 0x04) ............................................................ 34 figure 19-5. port 1 interrupt enable register (address 0x05) ............................................................ 34 figure 19-6. port 0 interrupt polarity register (address 0x06) ............................................................ 35 figure 19-7. port 1 interrupt polarity register (address 0x07) ............................................................ 35 figure 19-8. gpio interrupt diagram .......................................................................................... ........ 35 figure 24-1. clock timing .................................................................................................... ................ 45 figure 24-2. usb data signal timing .......................................................................................... ........ 45 figure 24-3. receiver jitter tolerance ....................................................................................... ......... 45 figure 24-4. differential to eop transition skew and eop width ...................................................... 46 figure 24-5. differential data jitter ........................................................................................ .............. 46 list of tables table 8-1. i/o register summary .............................................................................................. .......... 13 table 11-1. wake-up timer adjust settings .................................................................................... .... 18 table 12-1. ports 0 and 1 output control truth table ........................................................................ 2 1 table 13-1. control modes to force d+/d ? outputs ........................................................................... 24 table 19-1. interrupt vector assignments ..................................................................................... ...... 31 table 20-1. usb register mode encoding for control and non-control endpoint ............................. 36 table 20-2. decode table for table 20-3 : ? details of modes for differing traffic conditions ? ............. 38 table 20-3. details of modes for differing traffic conditions .............................................................. 39 table 26-1. cy7c63221a-xc probe pad coordinates in microns ((0,0) to bond pad centers) .......... 48
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 5 of 49 1.0 features  encore ? usb - enhanced component reduction ? internal oscillator eliminates the need for an external crystal or resonator ? interface can auto-configure to operate as ps/2 or usb without the need for external components to switch between modes (no gpio pins needed to manage dual mode capability) ? internal 3.3v regulator for usb pull-up resistor ? configurable gpio for real-world interface without external components  flexible, cost-effective solution for applications that combine ps/2 and low-speed usb, such as mice, gamepads, joysticks, and many others  usb specification compliance ? conforms to usb specification, version 2.0 ? conforms to usb hid specification, version 1.1 ? supports 1 low-speed usb device address ? supports 1 control endpoint and 1 data endpoint ? integrated usb transceiver ? 3.3v regulated output for usb pull-up resistor  8-bit risc microcontroller ? harvard architecture ? 6-mhz external ceramic resonator or internal clock mode ? 12-mhz internal cpu clock ? internal memory ? 96 bytes of ram ? 3 kbytes of eprom ? interface can auto-configure to operate as ps/2 or usb ? no external components for switching between ps/2 and usb modes  i/o ports ? up to 10 versatile general purpose i/o (gpio) pins, individually configurable ? high current drive on any gpio pin: 50 ma/pin current sink ? each gpio pin supports high-impedance inputs, internal pull-ups, open drain outputs, or traditional cmos outputs ? maskable interrupts on all i/o pins ? xtalin, xtalout and vreg can be configured as additional input pins  internal low-power wake-up timer during suspend mode ? periodic wake-up with no external components  optional 6-mhz internal oscillator mode ? allows fast start-up from suspend mode  watchdog timer (wdt)  low-voltage reset at 3.75v  internal brown-out reset for suspend mode  improved output drivers to reduce emi  operating voltage from 4.0v to 5.5vdc  operating temperature from 0 to 70 degrees celsius  cy7c63221a available in die form or 16-pin pdip  cy7c63231 available in 18-pin soic, 18-pin pdip  industry-standard programmer support
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 6 of 49 2.0 functional overview 2.1 encore usb - the new usb standard cypress has reinvented its leadership position in the low-speed usb market with a new family of innovative microcontrollers. introducing... encore? usb ?? enhanced component reduction. ? cypress has leveraged its design expertise in usb solutions to create a new family of low-speed usb microcontrollers that enables peripheral developers to design new products with a minimum number of components. at the heart of the cypress encore usb technology is the breakthrough design of a crystal- less oscillator. by integrating the oscillator into the chip, an external crystal or resonator is no longer needed. we have als o integrated other external components commonly found in low-speed usb applications such as pull-up resistors, wake-up circuitry, and a 3.3v regulator. all of this adds up to a lower system cost. the cy7c632xx family is comprised of 8-bit risc one time programmable (otp) microcontrollers. the instruction set has been optimized specifically for usb and ps/2 operations, although the microcontrollers can be used for a variety of other embedded applications. the cy7c632xx features up to 10 general-purpose i/o (gpio) pins to support usb, ps/2 and other applications. the i/o pins are grouped into two ports (port 0 to 1) where each pin can be individually configured as inputs with internal pull-ups, open d rain outputs, or traditional cmos outputs with programmable drive strength of up to 50 ma output drive. additionally, each i/o pin c an be used to generate a gpio interrupt to the microcontroller. the cy7c632xx microcontrollers feature an internal oscillator. with the presence of usb traffic, the internal oscillator can be set to precisely tune to usb timing requirements (6 mhz 1.5%). this clock generator has been optimized to reduce clock-related noise emissions (emi), and provides the 6-mhz and 12-mhz clocks that remain internal to the microcontroller. when using the internal oscillator, xtalin and xtalout can be configured as additional input pins that can be read on port 2. optionally, an external 6-mhz ceramic resonator can be used to provide a higher precision reference if needed. the cy7c632xx is offered with 3 kbytes of eprom to minimize cost, and has 96 bytes of data ram for stack space, user variables, and usb endpoint fifos. the cy7c632xx family includes low-voltage reset logic, a watchdog timer, a vectored interrupt controller, and a 12-bit free- running timer. the low-voltage reset (lvr) logic detects when power is applied to the device, resets the logic to a known state , and begins executing instructions at eprom address 0x0000. lvr will also reset the part when v cc drops below the operating voltage range. the watchdog timer can be used to ensure the firmware never gets stalled for more than approximately 8 ms. the microcontroller supports 7 maskable interrupts in the vectored interrupt controller. interrupt sources include the usb bus- reset, the 128- s and 1.024-ms outputs from the free-running timer, two usb endpoints, an internal wake-up timer and the gpio port. the timers bits cause periodic interrupts when enabled. the usb endpoints interrupt after usb transactions complete on the bus. the gpio port has a level of masking to select which gpio inputs can cause a gpio interrupt. for additional flexibilit y, the input transition polarity that causes an interrupt is programmable for each gpio pin. the interrupt polarity can be either rising or falling edge. the free-running 12-bit timer clocked at 1 mhz provides two interrupt sources as noted above (128 s and 1.024 ms). the timer can be used to measure the duration of an event under firmware control by reading the timer at the start and end of an event, and subtracting the two values. the cy7c63221/31a includes an integrated usb serial interface engine (sie). the hardware supports one usb device address with two endpoints. the sie allows the usb host to communicate with the function integrated into the microcontroller. a 3.3v regulated output pin provides a pull-up source for the external usb resistor on the d ? pin. when using an external voltage regulator vreg can be configured as an input pin that can be read on port 2 (p2.0). the usb d+ and d ? usb pins can alternately be used as ps/2 sclk and sdata signals, so that products can be designed to respond to either usb or ps/2 modes of operation. ps/2 operation is supported with internal pull-up resistors on sclk and sdata, the ability to disable the regulator output pin, and an interrupt to signal the start of ps/2 activity. no external comp onents are necessary for dual usb and ps/2 systems, and no gpio pins need to be dedicated to switching between modes. slow edge rates operate in both modes to reduce emi.
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 7 of 49 3.0 logic block diagram 4.0 pin configurations 5.0 pin assignments name i/o cy7c63221a cy7c63231/ cy7c63221-xc description 16-pin 18-pin/pad d ? /sdata, d+/sclk i/o 11 12 12 13 usb differential data lines (d ? and d+), or ps/2 clock and data signals (sdata and sclk) p0[7:0] i/o 1, 2, 3, 4, 13, 14, 15, 16 1, 2, 3, 4, 15, 16, 17, 18 gpio port 0 capable of sinking up to 50 ma/pin, or sinking controlled low or high programmable current. can also source 2 ma current, provide a resistive pull-up, or serve as a high- impedance input. p1[1:0] i/o na 5,14 io port 1 capable of sinking up to 50 ma/pin, or sinking controlled low or high programmable current. can also source 2 ma current, provide a resistive pull-up, or serve as a high-impedance input. internal oscillator wake-up timer ram 96 bytes 12-bit timer 8-bit risc core brown-out reset watch dog timer low voltage reset interrupt controller usb engine port 0 gpio port 1 gpio usb & ps/2 xcvr 3.3v regulator vreg/p2.0 d+ d- p0.0-p0.7 p1.0-p1.1 xtal oscillator eprom 3 kbytes xtalin/p2.1 xtalout xtalin/p2.1 xtalout/p2.2 1 2 3 4 6 7 8 9 10 11 13 14 16 15 p0.0 p0.1 p0.2 p0.3 v ss vreg/p2.0 p0.4 p0.6 p0.7 d+/sclk d ? /sdata v cc 16-pin pdip p0.5 v pp xtalin/p2.1 xtalout/p2.2 cy7c63221a 5 12 1 2 3 4 6 7 8 10 11 12 13 15 16 18 17 p0.0 p0.1 p0.2 p0.3 v ss vreg/p2.0 p0.4 p0.6 p0.7 d+/sclk d ? /sdata v cc 18-pin soic/pdip p0.5 9 v pp xtalin/p2.1 xtalout/p2.2 cy7c63231a 5 14 p1.0 p1.1 (top view) 4 5 3 p0.2 1 p0.0 2 p0.1 18 p0.4 17 p0.5 16 p0.6 15 14 7 8 9 10 11 12 13 p0.3 p1.0 vss vpp xtalin/p2.1 vreg/p2.0 xtalout/p2.2 vcc d-/sdata d+/sclk p0.7 p1.1 6 cy7c63221a-xc die
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 8 of 49 6.0 programming model refer to the cyasm assembler user ? s guide for more details on firmware operation with the cy7c632xx microcontrollers. 6.1 program counter (pc) the 14-bit program counter (pc) allows access for 3 kbytes of eprom using the cy7c632xx architecture. the program counter is cleared during reset, such that the first instruction executed after a reset is at address 0x0000. this is typically a jump instruction to a reset handler that initializes the application. the lower 8 bits of the program counter are incremented as instructions are loaded and executed. the upper 6 bits of the progra m counter are incremented by executing an xpage instruction. as a result, the last instruction executed within a 256-byte ? page ? of sequential code should be an xpage instruction. the assembler directive ? xpageon ? will cause the assembler to insert xpage instructions automatically. as instructions can be either one or two bytes long, the assembler may occasionally need to insert a nop followed by an xpage for correct execution. the program counter of the next instruction to be executed, carry flag, and zero flag are saved as two bytes on the program sta ck during an interrupt acknowledge or a call instruction. the program counter, carry flag, and zero flag are restored from the program stack only during a reti instruction. please note the program counter cannot be accessed directly by the firmware. the program stack can be examined by reading sram from location 0x00 and up. note that there are restrictions in using the jmp, call, and index instructions across the 4-kb boundary of the program memory. refer to the cyasm assembler user ? s guide for a detailed description. 6.2 8-bit accumulator (a) the accumulator is the general-purpose, do-everything register in the architecture where results are usually calculated. 6.3 8-bit index register (x) the index register ? x ? is available to the firmware as an auxiliary accumulator. the x register also allows the processor to perform indexed operations by loading an index value into x. 6.4 8-bit program stack pointer (psp) during a reset, the program stack pointer (psp) is set to zero. this means the program ? stack ? starts at ram address 0x00 and ? grows ? upward from there. note that the program stack pointer is directly addressable under firmware control, using the mov psp,a instruction. the psp supports interrupt service under hardware control and call, ret, and reti instructions under firmware control. during an interrupt acknowledge, interrupts are disabled and the program counter, carry flag, and zero flag are written as two bytes of data memory. the first byte is stored in the memory addressed by the program stack pointer, then the psp is incremente d. the second byte is stored in memory addressed by the program stack pointer and the psp is incremented again. the net effect is to store the program counter and flags on the program ? stack ? and increment the program stack pointer by two. the return from interrupt (reti) instruction decrements the program stack pointer, then restores the second byte from memory addressed by the psp. the program stack pointer is decremented again and the first byte is restored from memory addressed by the psp. after the program counter and flags have been restored from stack, the interrupts are enabled. the effect is to res tore the program counter and flags from the program stack, decrement the program stack pointer by two, and re-enable interrupts. xtalin/p2.1 in 8 9 6-mhz ceramic resonator or external clock input, or p2.1 input xtalout/p2.2 in 9 10 6-mhz ceramic resonator return pin or internal oscillator output, or p2.2 input v pp 6 7 programming voltage supply, ground for normal operation v cc 10 11 voltage supply vreg/p2.0 7 8 voltage supply for 1.3-k ? usb pull-up resistor (3.3v nominal). also serves as p2.0 input. v ss 5 6 ground 5.0 pin assignments (continued) name i/o cy7c63221a cy7c63231/ cy7c63221-xc description 16-pin 18-pin/pad
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 9 of 49 the call subroutine (call) instruction stores the program counter and flags on the program stack and increments the psp by two. the return from subroutine (ret) instruction restores the program counter, but not the flags, from program stack and decrements the psp by two. 6.5 8-bit data stack pointer (dsp) the data stack pointer (dsp) supports push and pop instructions that use the data stack for temporary storage. a push instruction will pre-decrement the dsp, then write data to the memory location addressed by the dsp. a pop instruction will rea d data from the memory location addressed by the dsp, then post-increment the dsp. during a reset, the data stack pointer will be set to zero. a push instruction when dsp equals zero will write data at the top of the data ram (address 0xff). this would write data to the memory area reserved for a fifo for usb endpoint 0. in non-usb applications, this works fine and is not a problem. for usb applications, the firmware should set the dsp to an appropriate location to avoid a memory conflict with ram dedicated to usb fifos. since there are only 80 bytes of ram available (except endpoint fifos) the dsp should be set between 0x00 and 0x4fh. the memory requirements for the usb endpoints are shown in section 8.2. for example, assembly instructions to set the dsp to 20h (giving 32 bytes for program and data stack combined) are shown below: mov a,20h ; move 20 hex into accumulator (must be d8h or less to avoid usb fifos) swap a,dsp ; swap accumulator value into dsp register 6.6 address modes the cy7c632xx microcontroller supports three addressing modes for instructions that require data operands: data, direct, and indexed. 6.6.1 data the ? data ? address mode refers to a data operand that is actually a constant encoded in the instruction. as an example, consider the instruction that loads a with the constant 0x30:  mov a, 30h this instruction will require two bytes of code where the first byte identifies the ? mov a ? instruction with a data operand as the second byte. the second byte of the instruction will be the constant ? 0xe8h ? . a constant may be referred to by name if a prior ? equ ? statement assigns the constant value to the name. for example, the following code is equivalent to the example shown above:  dspinit: equ 30h  mov a,dspinit 6.6.2 direct ? direct ? address mode is used when the data operand is a variable stored in sram. in that case, the one byte address of the variable is encoded in the instruction. as an example, consider an instruction that loads a with the contents of memory address location 0x10h:  mov a, [10h] in normal usage, variable names are assigned to variable addresses using ? equ ? statements to improve the readability of the assembler source code. as an example, the following code is equivalent to the example shown above:  buttons: equ 10h  mov a,[buttons] 6.6.3 indexed ? indexed ? address mode allows the firmware to manipulate arrays of data stored in sram. the address of the data operand is the sum of a constant encoded in the instruction and the contents of the ? x ? register. in normal usage, the constant will be the ? base ? address of an array of data and the x register will contain an index that indicates which element of the array is actually addressed:  array: equ 10h  mov x,3  mov a,[x+array] this would have the effect of loading a with the fourth element of the sram ? array ? that begins at address 0x10h. the fourth element would be at address 0x13h.
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 10 of 49 7.0 instruction set summary refer to the cyasm assembler user ? s guide for detailed information on these instructions. note that conditional jump instructions (i.e. jc, jnc, jz, jnz) take 5 cycles if jump is taken, 4 cycles if no jump. mnemonic operand opcode cycles mnemonic operand opcode cycles halt 00 7 nop 20 4 add a,expr data 01 4 inc a acc 21 4 add a,[expr] direct 02 6 inc x x 22 4 add a,[x+expr] index 03 7 inc [expr] direct 23 7 adc a,expr data 04 4 inc [x+expr] index 24 8 adc a,[expr] direct 05 6 dec a acc 25 4 adc a,[x+expr] index 06 7 dec x x 26 4 sub a,expr data 07 4 dec [expr] direct 27 7 sub a,[expr] direct 08 6 dec [x+expr] index 28 8 sub a,[x+expr] index 09 7 iord expr address 29 5 sbb a,expr data 0a 4 iowr expr address 2a 5 sbb a,[expr] direct 0b 6 pop a 2b 4 sbb a,[x+expr] index 0c 7 pop x 2c 4 or a,expr data 0d 4 push a 2d 5 or a,[expr] direct 0e 6 push x 2e 5 or a,[x+expr] index 0f 7 swap a,x 2f 5 and a,expr data 10 4 swap a,dsp 30 5 and a,[expr] direct 11 6 mov [expr],a direct 31 5 and a,[x+expr] index 12 7 mov [x+expr],a index 32 6 xor a,expr data 13 4 or [expr],a direct 33 7 xor a,[expr] direct 14 6 or [x+expr],a index 34 8 xor a,[x+expr] index 15 7 and [expr],a direct 35 7 cmp a,expr data 16 5 and [x+expr],a index 36 8 cmp a,[expr] direct 17 7 xor [expr],a direct 37 7 cmp a,[x+expr] index 18 8 xor [x+expr],a index 38 8 mov a,expr data 19 4 iowx [x+expr] index 39 6 mov a,[expr] direct 1a 5 cpl 3a 4 mov a,[x+expr] index 1b 6 asl 3b 4 mov x,expr data 1c 4 asr 3c 4 mov x,[expr] direct 1d 5 rlc 3d 4 reserved 1e rrc 3e 4 xpage 1f 4 ret 3f 8 mov a,x 40 4 di 70 4 mov x,a 41 4 ei 72 4 mov psp,a 60 4 reti 73 8 call addr 50 - 5f 10 jmp addr 80-8f 5 jc addr c0-cf 5 (or 4) call addr 90-9f 10 jnc addr d0-df 5 (or 4) jz addr a0-af 5 (or 4) jacc addr e0-ef 7 jnz addr b0-bf 5 (or 4) index addr f0-ff 14
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 11 of 49 8.0 memory organization 8.1 program memory organization after reset address 14-bit pc 0x0000 program execution begins here after a reset. 0x0002 usb bus reset interrupt vector 0x0004 128- s timer interrupt vector 0x0006 1.024-ms timer interrupt vector 0x0008 usb endpoint 0 interrupt vector 0x000a usb endpoint 1 interrupt vector 0x000c reserved 0x000e reserved 0x0010 reserved 0x0012 reserved 0x0014 gpio interrupt vector 0x0016 wake-up interrupt vector 0x0018 program memory begins here 0x0bdf 3 kb prom ends here (3k - 32 bytes). see note 1 below figure 8-1. program memory space with interrupt vector table note: 1. the upper 32 bytes of the 3k prom are reserved. therefore, user ? s program must not over-write this space.
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 12 of 49 8.2 data memory organization the cy7c632xx microcontroller provides 96 bytes of data ram. in normal usage, the sram is partitioned into four areas: program stack, data stack, user variables and usb endpoint fifos as shown below: after reset address 8-bit dsp 8-bit psp 0x00 program stack growth (user ? s firmware moves dsp) 8-bit dsp user selected data stack growth user variables 0x4f 0xf0 usb fifo for address a endpoint 1 0xf8 usb fifo for address a endpoint 0 top of ram memory 0xff
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 13 of 49 8.3 i/o register summary i/o registers are accessed via the i/o read (iord) and i/o write (iowr, iowx) instructions. iord reads the selected port into the accumulator. iowr writes data from the accumulator to the selected port. indexed i/o write (iowx) adds the contents of x to the address in the instruction to form the port address and writes data from the accumulator to the specified port. note tha t specifying address 0 with iowx (e.g., iowx 0h) means the i/o port is selected solely by the contents of x. note: all bits of all registers are cleared to all zeros on reset, except the processor status and control register ( figure 18- 1 ). all registers not listed are reserved, and should never be written by firmware. all bits marked as reserved should always be written as 0 and be treated as undefined by reads. table 8-1. i/o register summary register name i/o address read/write function fig. port 0 data 0x00 r/w gpio port 0 12-2 port 1 data 0x01 r/w gpio port 1 12-3 port 2 data 0x02 r auxiliary input register for d+, d ? , vreg, xtalin, xtalout 12-8 port 0 interrupt enable 0x04 w interrupt enable for pins in port 0 19-4 port 1 interrupt enable 0x05 w interrupt enable for pins in port 1 19-5 port 0 interrupt polarity 0x06 w interrupt polarity for pins in port 0 19-6 port 1 interrupt polarity 0x07 w interrupt polarity for pins in port 1 19-7 port 0 mode0 0x0a w controls output configuration for port 0 12-4 port 0 mode1 0x0b w 12-5 port 1 mode0 0x0c w controls output configuration for port 1 12-6 port 1 mode1 0x0d w 12-7 usb device address 0x10 r/w usb device address register 14-1 ep0 counter register 0x11 r/w usb endpoint 0 counter register 14-4 ep0 mode register 0x12 r/w usb endpoint 0 configuration register 14-2 ep1 counter register 0x13 r/w usb endpoint 1 counter register 14-4 ep1 mode register 0x14 r/w usb endpoint 1 configuration register 14-3 usb status & control 0x1f r/w usb status and control register 13-1 global interrupt enable 0x20 r/w global interrupt enable register 19-1 endpoint interrupt enable 0x21 r/w usb endpoint interrupt enables 19-2 timer (lsb) 0x24 r lower 8 bits of free-running timer (1 mhz) 17-1 timer (msb) 0x25 r upper 4 bits of free-running timer 17-2 wdr clear 0x26 w watch dog reset clear - clock configuration 0xf8 r/w internal / external clock configuration register 9-2 processor status & control 0xff r/w processor status and control 18-1
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 14 of 49 9.0 clocking the chip can be clocked from either the internal on-chip clock, or from an oscillator based on an external resonator/crystal, a s shown in figure 9-1 . no additional capacitance is included on chip at the xtalin/out pins. operation is controlled by the clock configuration register, figure 9-2 . bit 7: ext. clock resume delay external clock resume delay bit selects the delay time when switching to the external oscillator from the internal oscillator mode, or when waking from suspend mode with the external oscillator enabled. 1 = 4 ms delay. 0 = 128 s delay. the delay gives the oscillator time to start up. the shorter time is adequate for operation with ceramic resonators, while the longer time is preferred for start-up with a crystal. (these times do not include an initial oscillator start-up time which depends on the resonating element. this time is typically 50 ? 100 s for ceramic resonators and 1 ? 10 ms for crystals). note that this bit only selects the delay time for the external clock mode. when waking from suspend mode with the internal oscillator (bit 0 is low), the delay time is only 8 s in addition to a delay of approximately 1 s for the oscillator to start. bit [6:4]: wake-up timer adjust bit [2:0] the wake-up timer adjust bits are used to adjust the wake-up timer period. if the wake-up interrupt is enabled in the global interrupt enable register, the microcontroller will generate wake-up interrup ts periodically. the frequency of these periodical wake-up interrupts is adjusted by setting the wake-up timer adjust bit [2:0], as described in section 11.2. one common use of the wake-up interrupts is to generate periodical wake-up events during suspend mode to check for changes, such as looking for movement in a mouse, while maintaining a low average power. bit 3: low-voltage reset disable when v cc drops below v lvr (see section 23.0 for the value of v lvr ) and the low-voltage reset circuit is enabled, the microcontroller enters a partial suspend state for a period of t start (see section 24.0 for the value of t start ). program figure 9-1. clock oscillator on-chip circuit bit # 76543210 bit name ext. clock resume delay wake-up timer adjust bit [2:0] low-voltage reset disable precision usb clocking enable internal clock output disable external oscillator enable read/write r/w r/w r/w r/w r/w r/w r/w r/w reset 00000000 figure 9-2. clock configuration register (address 0xf8) xtalout xtalin clk2x (12 mhz) clock doubler clk1x (6 mhz) (to microcontroller) (to usb sie) port 2.1 ext osc enable port 2.2 int clk output disable internal osc
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 15 of 49 execution begins from address 0x0000 after this t start delay period. this provides time for v cc to stabilize before the part executes code. see section 10.1 for more details. 1 = disables the lvr circuit. 0 = enables the lvr circuit. bit 2: precision usb clocking enable the precision usb clocking enable only affects operation in internal oscillator mode. in that mode, this bit must be set to 1 to cause the internal clock to automatically precisely tune to usb timing requirements (6 mhz 1.5%) . the frequency may have a looser initial tolerance at power-up, but all usb transmissions from the chip will meet the usb specification. 1 = enabled. the internal clock accuracy is 6 mhz 1.5% after usb traffic is received . 0 = disabled. the internal clock accuracy is 6 mhz 5%. bit 1: internal clock output disable the internal clock output disable is used to keep the internal clock from driving out to the xtalout pin. this bit has no effec t in the external oscillator mode. 1 = disable internal clock output. xtalout pin will drive high. 0 = enable the internal clock output. the internal clock is driven out to the xtalout pin. bit 0: external oscillator enable at power-up, the chip operates from the internal clock by default. setting the external oscillator enable bit high disables the internal clock, and halts the part while the external resonator/crystal oscillator is started. clearing this bit has no immedia te effect, although the state of this bit is used when waking out of suspend mode to select between internal and external clock. in internal clock mode, xtalin pin will be configured as an input with a weak pull-down and can be used as a gpio input (p2.1). 1 = enable the external oscillator. the clock is switched to external clock mode, as described in section 9.1. 0 = enable the internal oscillator. 9.1 internal/external oscillator operation the internal oscillator provides an operating clock, factory set to a nominal frequency of 6 mhz. this clock requires no extern al components. at power-up, the chip operates from the internal clock. in this mode, the internal clock is buffered and driven to the xtalout pin by default, and the state of the xtalin pin can be read at port 2.1. while the internal clock is enabled, its outpu t can be disabled at the xtalout pin by setting the internal clock output disable bit of the clock configuration register. setting the external oscillator enable bit of the clock configuration register high disables the internal clock, and halts the part while the external resonator/crystal oscillator is started. the steps involved in switching from internal to external clock mod e are as follows: 1. at reset, chip begins operation using the internal clock. 2. firmware sets bit 0 of the clock configuration register. for example, mov a, 1h ; set bit 0 high (external oscillator enable bit). bit 7 cleared gives faster start-up iowr f8h ; write to clock configuration register 3. internal clocking is halted, the internal oscillator is disabled, and the external clock oscillator is enabled. 4. after the external clock becomes stable, chip clocks are re-enabled using the external clock signal. (note that the time for the external clock to become stable depends on the external resonating device; see next section.) 5. after an additional delay the cpu is released to run. this delay depends on the state of the ext. clock resume delay bit of the clock configuration register. the time is 128 s if the bit is 0, or 4 ms if the bit is 1. 6. once the chip has been set to external oscillator, it can only return to internal clock when waking from suspend mode. cleari ng bit 0 of the clock configuration register will not re-enable internal clock mode until suspend mode is entered. see section 11.0 for more details on suspend mode operation. if the internal clock is enabled, the xtalin pin can serve as a general-purpose input, and its state can be read at port 2, bit 1 (p2.1). refer to figure 12-8 for the port 2 data register. in this mode, there is a weak pull-down at the xtalin pin. this input cannot provide an interrupt source to the cpu. 9.2 external oscillator the user can connect a low-cost ceramic resonator or an external oscillator to the xtalin/xtalout pins to provide a precise reference frequency for the chip clock, as shown in figure 9-1 . the external components required are a ceramic resonator or crystal and any associated capacitors. to run from the external resonator, the external oscillator enable bit of the clock conf ig- uration register must be set to 1, as explained in the previous section.
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 16 of 49 start-up times for the external oscillator depend on the resonating device. ceramic-resonator-based oscillators typically start in less than 100 s, while crystal-based oscillators take longer, typically 1 to 10 ms. board capacitance should be minimized on the xtalin and xtalout pins by keeping the traces as short as possible. an external 6-mhz clock can be applied to the xtalin pin if the xtalout pin is left open. 10.0 reset the usb controller supports three types of resets. the effects of the reset are listed below. the reset types are: 1. low-voltage reset (lvr) 2. brown-out reset (bor) 3. watchdog reset (wdr) the occurrence of a reset is recorded in the processor status and control register ( figure 18-1 ). bits 4 (low-voltage or brown- out reset bit) and 6 (watchdog reset bit) are used to record the occurrence of lvr/bor and wdr respectively. the firmware can interrogate these bits to determine the cause of a reset. the microcontroller begins execution from rom address 0x0000 after a lvr, bor, or wdr reset. although this looks like interrupt vector 0, there is an important difference. reset processing does not push the program counter, carry flag, and zero flag onto program stack. attempting to execute either a ret or reti in the reset handler will cause unpredictable execution results. the following events take place on reset. more details on the various resets are given in the following sections. 1. all registers are reset to their default states (all bits cleared, except in processor status and control register). 2. gpio and usb pins are set to high-impedance state. 3. the vreg pin is set to high-impedance state. 4. interrupts are disabled. 5. usb operation is disabled and must be enabled by firmware if desired, as explained in section 14.1. 6. for a bor or lvr, the external oscillator is disabled and internal clock mode is activated, followed by a time-out period t start for v cc to stabilize. a wdr does not change the clock mode, and there is no delay for v cc stabilization on a wdr. note that the external oscillator enable (bit 0, figure 9-2 ) will be cleared by a wdr, but it does not take effect until suspend mode is entered. 7. the program stack pointer (psp) and data stack pointer (dsp) reset to address 0x00. firmware should move the dsp for usb applications, as explained in section 6.5. 8. program execution begins at address 0x0000 after the appropriate time-out period. 10.1 low-voltage reset (lvr) when v cc is first applied to the chip, the internal oscillator is started and the low-voltage reset is initially enabled by default. at the point where v cc has risen above v lvr (see section 23.0 for the value of v lvr ), an internal counter starts counting for a period of t start (see section 24.0 for the value of t start ). during this t start time, the microcontroller enters a partial suspend state to wait for v cc to stabilize before it begins executing code from address 0x0000. as long as the lvr circuit is enabled, this reset sequence repeats whenever the v cc pin voltage drops below v lvr . the lvr can be disabled by firmware by setting the low-voltage reset disable bit in the clock configuration register ( figure 9-2 ). in addition, the lvr is automatically disabled in suspend mode to save power. if the lvr was enabled before entering suspend mode, it becomes active again once the suspend mode ends. when lvr is disabled during normal operation (e.g., by writing ? 0 ? to the low-voltage reset disable bit in the clock configuration register), the chip may enter an unknown state if v cc drops below v lvr . therefore, lvr should be enabled at all times during normal operation. if lvr is disabled (e.g., by firmware or during suspend mode), a secondary low-voltage monitor, bor, becomes active, as described in the next section. the lvr/bor reset bit of the processor status and control register ( figure 18-1 ), is set to ? 1 ? if either a lvr or bor has occurred. 10.2 brown-out reset (bor) the brown-out reset (bor) circuit is always active and behaves like the por. bor is asserted whenever the v cc voltage to the device is below an internally defined trip voltage of approximately 2.5v. the bor re-enables lvr. that is, once v cc drops and trips bor, the part remains in reset until v cc rises above v lvr . at that point, the t start delay occurs before normal operation resumes, and the microcontroller starts executing code from address 0x00 after the t start delay. in suspend mode, only the bor detection is active, giving a reset if v cc drops below approximately 2.5v. since the device is suspended and code is not executing, this lower reset voltage is safe for retaining the state of all registers and memory. note that in suspend mode, lvr is disabled as discussed in section 10.1.
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 17 of 49 10.3 watchdog reset (wdr) the watchdog timer reset (wdr) occurs when the internal watchdog timer rolls over. writing any value to the write-only watchdog reset register at address 0x26 will clear the timer. the timer will roll over and wdr will occur if it is not cleared within t watch (see figure 10-1 ) of the last clear. bit 6 (watchdog reset bit) of the processor status and control register is set to record this event (see section 18.0 for more details). a watchdog timer reset lasts for typically 2 ? 4 ms after which the microcontroller begins execution at rom address 0x0000. figure 10-1. watchdog reset (wdr, address 0x26) 11.0 suspend mode the cy7c632xx parts support a versatile low-power suspend mode. in suspend mode, only an enabled interrupt or a low state on the d ? /sdata pin will wake the part. two options are available. for lowest power, all internal circuits can be disabled, so only an external event will resume operation. alternatively, a low-power internal wake-up timer can be used to trigger the wake-up interrupt. this timer is described in section 11.2, and can be used to periodically poll the system to check for changes, such as looking for movement in a mouse, while maintaining a low average power. the cy7c632xx is placed into a low-power state by setting the suspend bit of the processor status and control register ( figure 18-1 ). all logic blocks in the device are turned off except the gpio interrupt logic, the d ? /sdata pin input receiver, and (optionally) the wake-up timer. the clock oscillators, as well as the free-running and watchdog timers are shut down. only the occurrence of an enabled gpio interrupt, wake-up interrupt, spi slave interrupt, or a low state on the d ? /sdata pin will wake the part from suspend (d ? low indicates non-idle usb activity). once one of these resuming conditions occurs, clocks will be restarted and the device returns to full operation after the oscillator is stable and the selected delay period expires. this d elay period is determined by selection of internal vs. external clock, and by the state of the ext. clock resume delay as explained in section 9.0. in suspend mode, any enabled and pending interrupt will wake the part up. the state of the interrupt enable sense bit (bit 2, figure 18-1 ) does not have any effect. as a result, any interrupts not intended for waking from suspend should be disabled through the global interrupt enable register and the usb end point interrupt enable register (section 19.0). if a resuming condition exists when the suspend bit is set, the part will still go into suspend and then awake after the approp riate delay time. the run bit in the processor status and control register must be set for the part to resume out of suspend. once the clock is stable and the delay time has expired, the microcontroller will execute the instruction following the i/o wri te that placed the device into suspend mode before servicing any interrupt requests. to achieve the lowest possible current during suspend mode, all i/o should be held at either v cc or ground . in addition, the gpio bit interrupts ( figure 19-4 and figure 19-5 ) should be disabled for any pins that are not being used for a wake-up interrupt. this should be done even if the main gpio interrupt enable ( figure 19-1 ) is off. typical code for entering suspend is shown below: ... ; all gpio set to low-power state (no floating pins, and bit interrupts disabled unless using for wake-up) ... ; enable gpio and/or wake-up timer interrupts if desired for wake-up ... ; select clock mode for wake-up (see section 11.1) mov a, 09h ; set suspend and run bits iowr ffh ; write to status and control register - enter suspend, wait for gpio/wake-up interrupt or usb activity nop ; this executes before any isr ... ; remaining code for exiting suspend routine at least 10.1 ms wdr goes high execution begins at rom address 0x0000 2 ? 4 ms since last write to wdr for 2 ? 4 ms 14.6 ms (at f osc = 6 mhz) wdr t watch = 10.1 to
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 18 of 49 11.1 clocking mode on wake-up from suspend when exiting suspend on a wake-up event, the device can be configured to run in either internal or external clock mode. the mode is selected by the state of the external oscillator enable bit in the clock configuration register ( figure 9-2 ). using the internal clock saves the external oscillator start-up time and keeps that oscillator off for additional power savings. the exte rnal oscillator mode can be activated when desired, similar to operation at power-up. the sequence of events for these modes is as follows: wake in internal clock mode: 1. before entering suspend, clear bit 0 of the clock configuration register. this selects internal clock mode after suspend. 2. enter suspend mode by setting the suspend bit of the processor status and control register. 3. after a wake-up event, the internal clock starts immediately (within 2 s). 4. a time-out period of 8 s passes, and then firmware execution begins. 5. at some later point, to activate external clock mode, set bit 0 of the clock configuration register. this halts the internal clocks while the external clock becomes stable. after an additional time-out (128 s or 4 ms, see section 9.0), firmware execution resumes. wake in external clock mode: 1. before entering suspend, the external clock must be selected by setting bit 0 of the clock configuration register. make sure this bit is still set when suspend mode is entered. this selects external clock mode after suspend. 2. enter suspend mode by setting the suspend bit of the processor status and control register. 3. after a wake-up event, the external oscillator is started. the clock is monitored for stability (this takes approximately 50 ? 100 s with a ceramic resonator). 4. after an additional time-out period (128 s or 4 ms, see section 9.0), firmware execution resumes. 11.2 wake-up timer the wake-up timer runs whenever the wake-up interrupt is enabled, and is turned off whenever that interrupt is disabled. operation is independent of whether the device is in suspend mode or if the global interrupt bit is enabled. only the wake-up timer interrupt enable bit ( figure 19-1 ) controls the wake-up timer. once this timer is activated, it will give interrupts after its time-out period (see below). these interrupts continue periodic ally until the interrupt is disabled. whenever the interrupt is disabled, the wake-up timer is reset, so that a subsequent enable always results in a full wake-up time. the wake-up timer can be adjusted by the user through the wake-up timer adjust bits in the clock configuration register ( figure 9-2 ). these bits clear on reset. in addition to allowing the user to select a range for the wake-up time, a firmware algorithm can be used to tune out initial process and operating condition variations in this wake-up time. this can be done by timing the wake-up interrupt time with the accurate 1.024-ms timer interrupt, and adjusting the timer adjust bits accordingly to approxima te the desired wake-up time. table 11-1. wake-up timer adjust settings adjust bits [2:0] (bits [6:4] in figure 9-2 ) wake-up time 000 (reset state) 1 * t wake 001 2 * t wake 010 4 * t wake 011 8 * t wake 100 16 * t wake 101 32 * t wake 110 64 * t wake 111 128 * t wake see section 24.0 for the value of t wake
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 19 of 49 12.0 general purpose i/o ports ports 0 and 1 provide up to 10 versatile gpio pins that can be read or written (the number of pins depends on package type). figure 12-1. block diagram of gpio port (one pin shown) port 0 is an 8-bit port; port 1 contains 2 bits, p1.1 ? p1.0 in the cy7c63231 and cy7c63221a-xc parts. each bit can also be selected as an interrupt source for the microcontroller. the data for each gpio pin is accessible through the port data register. writes to the port data register store outgoing data state for the port pins, while reads from the port data register return the actual logic value on the port pins, not the port d ata register contents. each gpio pin is configured independently. the driving state of each gpio pin is determined by the value written to the pin ? s data register and by two associated pin ? s mode0 and mode1 bits. the port 0 data register is shown in figure 12-2 , and the port 1 data register is shown in figure 12-3 . the mode0 and mode1 bits for the two gpio ports are given in figure 12-4 through figure 12-7 . bit [7:0]: p0[7:0] 1 = port pin is logic high 0 = port pin is logic low bit # 76543210 bit name p0 read/write r/w r/w r/w r/w r/w r/w r/w r/w reset 00000000 figure 12-2. port 0 data (address 0x00) gpio pin v cc 14 k ? gpio mode data out register internal data bus port read port write interrupt enable interrupt control to interrupt controller q1 q2 q3 logic interrupt polarity 2 threshold select
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 20 of 49 bit [7:2]: reserved bit [1:0]: p1[1:0] 1 = port pin is logic high 0 = port pin is logic low bit [7:0]: p0[7:0] mode 0 1 = port pin mode 0 is logic high 0 = port pin mode 0 is logic low bit [7:0]: p0[7:0] mode 1 1 = port pin mode 1 is logic high 0 = port pin mode 1 is logic low bit [7:2]: reserved bit [1:0]: p1[1:0] mode 0 1 = port pin mode 0 is logic high 0 = port pin mode 0 is logic low bit # 76543210 bit name reserved p1[1:0] notes pins 1:0 in all parts read/write ------r/wr/w reset 00000000 figure 12-3. port 1 data (address 0x01) bit # 76543210 bit name p0[7:0] mode0 read/write wwwwwwww reset 00000000 figure 12-4. gpio port 0 mode0 register (address 0x0a) bit # 76543210 bit name p0[7:0] mode1 read/write wwwwwwww reset 00000000 figure 12-5. gpio port 0 mode1 register (address 0x0b) bit #76543210 bit name reserved p1[1:0] mode0 read/write ------ww reset 00000000 figure 12-6. gpio port 1 mode0 register (address 0x0c)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 21 of 49 bit [7:2]: reserved bit [1:0]: p1[1:0] mode 1 1 = port pin mode 1 is logic high 0 = port pin mode 1 is logic low each pin can be independently configured as high-impedance inputs, inputs with internal pull-ups, open drain outputs, or tradi- tional cmos outputs with selectable drive strengths. the driving state of each gpio pin is determined by the value written to the pin ? s data register and by its associated mode0 and mode1 bits. table 12-1 lists the configuration states based on these bits. the gpio ports default on reset to all data and mode registers cleared, so the pins are all in a high-impedance state. the available gpio output drive strength are:  hi-z mode (mode1 = 0 and mode0 = 0) q1, q2, and q3 ( figure 12-1 ) are off. the gpio pin is not driven internally. performing a read from the port data register return the actual logic value on the port pins.  low sink mode (mode1 = 1, mode0 = 0, and the pin ? s data register = 0) q1 and q3 are off. q2 is on. the gpio pin is capable of sinking 2 ma of current.  medium sink mode (mode1 = 0, mode0 = 1, and the pin ? s data register = 0) q1 and q3 are off. q2 is on. the gpio pin is capable of sinking 8 ma of current.  high sink mode (mode1 = 1, mode0 = 1, and the pin ? s data register = 0) q1 and q3 are off. q2 is on. the gpio pin is capable of sinking 50 ma of current.  high drive mode (mode1 = 0 or 1, mode0 = 1, and the pin ? s data register = 1) q1 and q2 are off. q3 is on. the gpio pin is capable of sourcing 2 ma of current.  resistive mode (mode1 = 1, mode0 = 0, and the pin ? s data register = 1) q2 and q3 are off. q1 is on. the gpio pin is pulled up with an internal 14-k ? resistor. note that open drain mode can be achieved by fixing the data and mode1 registers low, and switching the mode0 register. input thresholds are cmos, or ttl as shown in the table (see section 23.0 for the input threshold voltage in ttl or cmos modes). both input modes include hysteresis to minimize noise sensitivity. in suspend mode, if a pin is used for a wake-up interrupt using an external r-c circuit, cmos mode is preferred for lowest power. 12.1 auxiliary input port port 2 serves as an auxiliary input port as shown in figure 12-8 . the port 2 inputs all have ttl input thresholds. bit #76543210 bit name reserved p1[1:0] mode1 read/write ------ww reset 00000000 figure 12-7. gpio port 1 mode1 register (address 0x0d) table 12-1. ports 0 and 1 output control truth table data register mode1 mode0 output drive strength input threshold 0 00 hi-z cmos 1 hi-z ttl 0 01 medium (8 ma) sink cmos 1 high drive cmos 0 10 low (2 ma) sink cmos 1resistivecmos 0 11 high (50 ma) sink cmos 1 high drive cmos
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 22 of 49 bit [7:6]: reserved bit [5:4]: d+ (sclk) and d- (sdata) states the state of the d+ and d ? pins can be read at port 2 data register. performing a read from the port pins returns their logic values. 1 = port pin is logic high 0 = port pin is logic low bit 3: reserved bit 2: p2.2 (internal clock mode only) in the internal clock mode, the xtalout pin can serve as a general purpose input, and its state can be read at port 2, bit 2 (p2.2). see section 9.1 for more details. 1 = port pin is logic high 0 = port pin is logic low bit 1: p2.1 (internal clock mode only) in the internal clock mode, the xtalin pin can serve as a general purpose input, and its state can be read at port 2, bit 1 (p2.1). see section 9.1 for more details. 1 = port pin is logic high 0 = port pin is logic low bit 0: p2.0/ vreg pin state in ps/2 mode, the vreg pin can be used as an input and its state can be read at port p2.0. section 15.0 for more details. 1 = port pin is logic high 0 = port pin is logic low 13.0 usb serial interface engine (sie) the sie allows the microcontroller to communicate with the usb host. the sie simplifies the interface between the microcon- troller and usb by incorporating hardware that handles the following usb bus activity independently of the microcontroller:  translate the encoded received data and format the data to be transmitted on the bus.  crc checking and generation. flag the microcontroller if errors exist during transmission.  address checking. ignore the transactions not addressed to the device.  send appropriate ack/nak/stall handshakes.  token type identification (setup, in, or out). set the appropriate token bit once a valid token is received.  place valid received data in the appropriate endpoint fifos.  send and update the data toggle bit (data1/0).  bit stuffing/unstuffing. firmware is required to handle the rest of the usb interface with the following tasks:  coordinate enumeration by decoding usb device requests.  fill and empty the fifos.  suspend/resume coordination.  verify and select data toggle values. bit #76543210 bit name reserved d+ (sclk) state d ? (sdata) state reserved p2.2 (internal clock mode only) p2.1 (internal clock mode only) p2.0 vreg pin state read/write - - rr - rrr reset 00000000 figure 12-8. port 2 data register (address 0x02)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 23 of 49 13.1 usb enumeration a typical usb enumeration sequence is shown below. in this description, ? firmware ? refers to embedded firmware in the cy7c632xx controller. 1. the host computer sends a setup packet followed by a data packet to usb address 0 requesting the device descriptor. 2. firmware decodes the request and retrieves its device descriptor from the program memory tables. 3. the host computer performs a control read sequence and firmware responds by sending the device descriptor over the usb bus, via the on-chip fifo. 4. after receiving the descriptor, the host sends a setup packet followed by a data packet to address 0 assigning a new usb address to the device. 5. firmware stores the new address in its usb device address register after the no-data control sequence completes. 6. the host sends a request for the device descriptor using the new usb address. 7. firmware decodes the request and retrieves the device descriptor from program memory tables. 8. the host performs a control read sequence and firmware responds by sending its device descriptor over the usb bus. 9. the host generates control reads from the device to request the configuration and report descriptors. 10.once the device receives a set configuration request, its functions may now be used. 11.firmware should take appropriate action for endpoint 1 transactions, which may occur from this point. 13.2 usb port status and control usb status and control is regulated by the usb status and control register as shown in figure 13-1 . bit 7: ps/2 pull-up enable this bit is used to enable the internal ps/2 pull-up resistors on the sdata and sclk pins. normally the output high level on these pins is v cc , but note that the output will be clamped to approximately 1 volt above v reg if the vreg enable bit is set, or if the device address is enabled (bit 7 of the usb device address register, figure 14-1 ). 1 = enable ps/2 pull-up resistors. the sdata and sclk pins are pulled up internally to v cc with two resistors of approximately 5k ? (see section 23.0 for the value of r ps2 ). 0 = disable ps/2 pull-up resistors. bit 6: vreg enable a 3.3v voltage regulator is integrated on chip to provide a voltage source for a 1.5-k ? pull-up resistor connected to the d ? pin as required by the usb specification. note that the vreg output has an internal series resistance of approximately 200 ? , the external pull-up resistor required is approximately 1.3-k ? (see figure 16-1 ). 1 = enable the 3.3v output voltage on the vreg pin. 0 = disable. the vreg pin can be configured as an input. bit 5: usb-ps/2 interrupt select this bit allows the user to select whether an usb bus reset interrupt or a ps/2 activity interrupt will be generated when the interrupt conditions are detected. 1 = ps/2 interrupt mode. a ps/2 activity interrupt will occur if the sdata pin is continuously low for 128 to 256 s. 0 = usb interrupt mode (default state). in this mode, a usb bus reset interrupt will occur if the single ended zero (se0, d ? and d+ are low) exists for 128 to 256 s. see section 19.0 for more details. bit 4: reserved. must be written as a ? 0 ? . bit # 76543210 bit name ps/2 pull-up enable vreg enable usb reset- ps/2 activity interrupt mode reserved usb bus activity d+/d- forcing bit read/write r/w r/w r/w - r/w r/w r/w r/w reset 00000000 figure 13-1. usb status and control register (address 0x1f)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 24 of 49 bit 3: usb bus activity the bus activity bit is a ? sticky ? bit that detects any non-idle usb event has occurred on the usb bus. once set to high by the sie to indicate the bus activity, this bit retains its logical high value until firmware clears it. writing a ? 0 ? to this bit clears it; writing a ? 1 ? preserves its value. the user firmware should check and clear this bit periodically to detect any loss of bus activity. firmware can clear the bus activity bit, but only the sie can set it. the 1.024-ms timer interrupt service routine is normally used to check and clear the bus activity bit. 1 = there has been bus activity since the last time this bit was cleared. this bit is set by the sie. 0 = no bus activity since last time this bit was cleared (by firmware). bit [2:0]: d+/d ? forcing bit [2:0] forcing bits allow firmware to directly drive the d+ and d ? pins, as shown in table 13-1 . outputs are driven with controlled edge rates in these modes for low emi. for forcing the d+ and d ? pins in usb mode, d+/d ? forcing bit 2 should be 0. setting d+/d ? forcing bit 2 to ? 1 ? puts both pins in an open-drain mode, preferred for applications such as ps/2 or led driving. table 13-1. control modes to force d+/d ? outputs d+/d ? forcing bit [2:0] control action application 000 not forcing (sie controls driver) any mode 001 force k (d+ high, d ? low) usb mode 010 force j (d+ low, d ? high) 011 force se0 (d ? low, d+ low) 100 force d ? low, d+ low ps/2 mode [2] 101 force d ? low, d+ hiz 110 force d ? hiz, d+ low 111 force d ? hiz, d+ hiz note: 2. for ps/2 operation, the d+/d- forcing bit [2:0] = 111b mode must be set initially (one time only) before using the other ps/2 force modes.
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 25 of 49 14.0 usb device the cy7c632xx supports one usb device address with two endpoints: ep0 and ep1. 14.1 usb address register the usb device address register contains a 7-bit usb address and one bit to enable usb communication. this register is cleared during a reset, setting the usb device address to zero and marking this address as disabled. figure 14-1 shows the format of the usb address register. in either usb or ps/2 mode, this register is cleared by both hardware resets and the usb bus reset. see section 19.3 for more information on the usb bus reset - ps/2 interrupt. bit 7: device address enable this bit must be enabled by firmware before the serial interface engine (sie) will respond to usb traffic at the address specif ied in bit [6:0]. 1 = enable usb device address. 0 = disable usb device address. bit [6:0]: device address bit[6:0] these bits must be set by firmware during the usb enumeration process (i.e., setaddress) to the non-zero address assigned by the usb host. 14.2 usb control endpoint all usb devices are required to have an endpoint number 0 (ep0) that is used to initialize and control the usb device. ep0 provides access to the device configuration information and allows generic usb status and control accesses. ep0 is bidirectiona l, as the device can both receive and transmit data. ep0 uses an 8-byte fifo at sram locations 0xf8-0xff, as shown in section 8.2. the ep0 endpoint mode register uses the format shown in figure 14-2 . the sie provides a locking feature to prevent firmware from overwriting bits in the usb endpoint 0 mode register. writes to the register have no effect from the point that bit[6:0] of the register are updated (by the sie) until the firmware reads this reg ister. the cpu can unlock this register by reading it. because of these hardware-locking features, firmware should perform an read after a write to the usb endpoint 0 mode register and usb endpoint 0 count register ( figure 14-4 ) to verify that the contents have changed as desired, and that the sie has not updated these values. bit [7:4] of this register are cleared by any non-locked write to this register, regardless of the value written. bit 7: setup received 1 = a valid setup packet has been received. this bit is forced high from the start of the data packet phase of the setup transaction until the start of the ack packet returned by the sie. the cpu is prevented from clearing this bit during this inte rval. bit # 76543210 bit name device address enable device address bit read/write r/w r/w r/w r/w r/w r/w r/w r/w reset 00000000 figure 14-1. usb device address register (address 0x10) bit # 76543210 bit name setup received in received out received acked transaction mode bit read/write r/w r/w r/w r/w r/w r/w r/w r/w reset 00000000 figure 14-2. endpoint 0 mode register (address 0x12)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 26 of 49 while this bit is set to ? 1 ? , the cpu cannot write to the ep0 fifo. this prevents firmware from overwriting an incoming setup transaction before firmware has a chance to read the setup data. 0 = no setup received. this bit is cleared by any non-locked writes to the register. bit 6: in received 1 = a valid in packet has been received. this bit is updated to ? 1 ? after the last received packet in an in transaction. this bit is cleared by any non-locked writes to the register. 0 = no in received. this bit is cleared by any non-locked writes to the register. bit 5: out received 1 = a valid out packet has been received. this bit is updated to ? 1 ? after the last received packet in an out transaction. this bit is cleared by any non-locked writes to the register. 0 = no out received. this bit is cleared by any non-locked writes to the register. bit 4: acked transaction the acked transaction bit is set whenever the sie engages in a transaction to the register's endpoint that completes with an ack packet. 1 = the transaction completes with an ack 0 = the transaction does not complete with an ack bit [3:0]: mode bit[3:0] the endpoint modes determine how the sie responds to usb traffic that the host sends to the endpoint. for example, if the endpoint mode bits [3:0] are set to 0001 which is nak in/out mode as shown in table 20-1 , the sie will send nak hand- shakes in response to any in or out token sent to this endpoint. in this nak in/out mode, the sie will send an ack handshake when the host sends a setup token to this endpoint. the mode encoding is shown in table 20-1 . additional information on the mode bits can be found in table 20-2 and table 20-3 . these modes give the firmware total control on how to respond to different tokens sent to the endpoints from the host. in addition, the mode bits are automatically changed by the sie in response to many usb transactions. for example, if the mode bit [3:0] are set to 1011 which is ack out-nak in mode as shown in table 20-1 , the sie will change the endpoint mode bit [3:0] to nak in/out (0001) mode after issuing an ack handshake in response to an out token. firmware needs to update the mode for the sie to respond appropriately. 14.3 usb non-control endpoints the cy7c632xx feature one non-control endpoint, endpoint 1 (ep1). the ep1 mode register does not have the locking mechanism of the ep0 mode register. the ep1 mode register uses the format shown in figure 14-3 . ep1 uses an 8-byte fifo at sram locations 0xf0 ? 0xf7 as shown in section 8.2. bit 7: stall 1 = the sie will stall an out packet if the mode bits are set to ack-out, and the sie will stall an in packet if the mode bits are set to ack-in. see section 20.0 for the available modes. 0 = this bit must be set to low for all other modes. bit [6:5]: reserved. must be written to zero during register writes. bit 4: acked transaction the acked transaction bit is set whenever the sie engages in a transaction to the register's endpoint that completes with an ack packet. 1 = the transaction completes with an ack. 0 = the transaction does not complete with an ack. bit # 76543210 bit name stall reserved acked transaction mode bit read/write r/w - - r/c r/w r/w r/w r/w reset 00000000 figure 14-3. usb endpoint ep1 mode registers (address 0x14)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 27 of 49 bit [3:0]: mode bit [3:0] the ep1 mode bits operate in the same manner as the ep0 mode bits (see section 14.2). 14.4 usb endpoint counter registers there are two endpoint counter registers, with identical formats for both control and non-control endpoints. these registers contain byte count information for usb transactions, as well as bits for data packet status. the format of these registers is s hown in figure 14-4 . bit 7: data toggle this bit selects the data packet ? s toggle state. for in transactions, firmware must set this bit to the select the transmitted data toggle. for out or setup transactions, the hardware sets this bit to the state of the received data toggle bit. 1 = data1 0 = data0 bit 6: data valid this bit is used for out and setup tokens only. this bit is cleared to ? 0 ? if crc, bitstuff, or pid errors have occurred. this bit does not update for some endpoint mode settings. refer to table 20-3 for more details. 1 = data is valid. 0 = data is invalid. if enabled, the endpoint interrupt will occur even if invalid data is received. bit [5:4]: reserved bit [3:0]: byte count bit [3:0] byte count bits indicate the number of data bytes in a transaction: for in transactions, firmware loads the count with the number of bytes to be transmitted to the host from the endpoint fifo. valid values are 0 to 8 inclusive. for out or setup transactions, the count is updated by hardware to the number of data bytes received, plus 2 for the crc bytes. valid values are 2 to 10 inclusive. for endpoint 0 count register, whenever the count updates from a setup or out transaction, the count register locks and cannot be written by the cpu. reading the register unlocks it. this prevents firmware from overwriting a status update on incoming setup or out transactions before firmware has a chance to read the data. 15.0 usb regulator output the vreg pin provides a regulated output for connecting the pull-up resistor required for usb operation. for usb, a 1.5-k ? resistor is connected between the d ? pin and the vreg voltage, to indicate low-speed usb operation. since the vreg output has an internal series resistance of approximately 200 ? , the external pull-up resistor required is r pu (see section 23.0). the regulator output is placed in a high-impedance state at reset, and must be enabled by firmware by setting the vreg enable bit in the usb status and control register ( figure 13-1 ). this simplifies the design of a combination ps/2-usb device, since the usb pull-up resistor can be left in place during ps/2 operation without loading the ps/2 line. in this mode, the vreg pin can be used as an input and its state can be read at port p2.0. refer to figure 12-8 for the port 2 data register. this input has a ttl threshold. in suspend mode, the regulator is automatically disabled. if vreg enable bit is set ( figure 13-1 ), the vreg pin is pulled up to v cc with an internal 6.2-k ? resistor. this holds the proper v oh state in suspend mode. note that enabling the device for usb (by setting the device address enable bit, figure 14-1 ) activates the internal regulator, even if the vreg enable bit is cleared to 0. this insures proper usb signaling in the case where the vreg pin is used as an input, and an external regulator is provided for the usb pull-up resistor. this also limits the swing on the d ? and d+ pins to about 1v above the internal regulator voltage, so the device address enable bit normally should only be set for usb operating modes. the regulator output is only designed to provide current for the usb pull-up resistor. in addition, the output voltage at the v reg pin is effectively disconnected when the cy7c632xx device transmits usb from the internal sie. this means that the vreg pin does not provide a stable voltage during transmits, although this does not affect usb signaling. bit # 76543210 bit name data toggle data valid reserved byte count read/write r/w r/w - - r/w r/w r/w r/w reset 00000000 figure 14-4. endpoint 0 and 1 counter registers (addresses 0x11 and 0x13)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 28 of 49 16.0 ps/2 operation the cy7c632xx parts are optimized for combination usb or ps/2 devices, through the following features: 1. usb d+ and d ? lines can also be used for ps/2 sclk and sdata pins, respectively. with usb disabled, these lines can be placed in a high-impedance state that will pull up to v cc . (disable usb by clearing the address enable bit of the usb device address register, figure 14-1 .) 2. an interrupt is provided to indicate a long low state on the sdata pin. this eliminates the need to poll this pin to check fo r ps/2 activity. refer to section 19.3 for more details. 3. internal ps/2 pull-up resistors can be enabled on the sclk and sdata lines, so no gpio pins are required for this task (bit 7, usb status and control register, figure 13-1 ). 4. the controlled slew rate outputs from these pins apply to both usb and ps/2 modes to minimize emi. 5. the state of the sclk and sdata pins can be read, and can be individually driven low in an open drain mode. the pins are read at bits [5:4] of port 2, and are driven with the control bits [2:0] of the usb status and control register. 6. the vreg pin can be placed into a high-impedance state, so that a usb pull-up resistor on the d ? /sdata pin will not interfere with ps/2 operation (bit 6, usb status and control register). the ps/2 on-chip support circuitry is illustrated in figure 16-1 . 17.0 12-bit free-running timer the 12-bit timer operates with a 1- s tick, provides two interrupts (128 s and 1.024ms) and allows the firmware to directly time events that are up to 4 ms in duration. the lower 8 bits of the timer can be read directly by the firmware. reading the lower 8 bits latches the upper 4 bits into a temporary register. when the firmware reads the upper 4 bits of the timer, it is actually readi ng the count stored in the temporary register. the effect of this is to ensure a stable 12-bit timer value can be read, even when the two reads are separated in time. figure 16-1. diagram of usb - ps/2 system connections d ? /sdata d+/sclk 5 k ? 3.3v regulator 5 k ? v cc usb - ps/2 driver 1.3 k ? vreg vreg enable ps/2 pull-up enable port 2.0 on-chip off-chip port 2.5 port 2.4 200 ?
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 29 of 49 bit [7:0]: timer lower 8 bits bit [7:4]: reserved bit [3:0]: timer upper 4 bits 18.0 processor status and control register bit 7: irq pending when an interrupt is generated, it is registered as a pending interrupt. the interrupt will remain pending until its interrupt enable bit is set ( figure 19-1 and figure 19-2 ) and interrupts are globally enabled (bit 2, processor status and control register). at that point the internal interrupt handling sequence will clear the irq pending bit until another interrupt is detected as pendi ng. this bit is only valid if the global interrupt enable bit is disabled. bit # 76543210 bit name timer [7:0] read/write rrrrrrrr reset 00000000 figure 17-1. timer lsb register (address 0x24) bit # 76543210 bit name reserved timer [11:8] read/write ----rrrr reset 00000000 figure 17-2. timer msb register (address 0x25) figure 17-3. timer block diagram bit # 76543210 bit name irq pending watchdog reset bus interrupt event lvr/bor reset suspend interrupt enable sense reserved run read/write r r/w r/w r/w r/w r - r/w reset 01010001 figure 18-1. processor status and control register (address 0xff) 10 9 7 85 6432 1 mhz clock 1.024-ms interrupt 128- s interrupt to timer registers 8 1 0 11 l1 l0 l2 l3 d3 d2 d1 d0 d7 d6 d5 d4 d3 d2 d1 d0
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 30 of 49 1 = there are pending interrupts. 0 = no pending interrupts. bit 6: watchdog reset the watchdog timer reset (wdr) occurs when the internal watchdog timer rolls over. the timer will roll over and wdr will occur if it is not cleared within t watch (see section 24.0 for the value of t watch ). this bit is cleared by an lvr/bor. note that a watchdog reset can occur with a por/lvr/bor event, as discussed at the end of this section. 1 = a watchdog reset occurs. 0 = no watchdog reset. bit 5: bus interrupt event the bus reset status is set whenever the event for the usb bus reset or ps/2 activity interrupt occurs. the event type (usb or ps/2) is selected by the state of the usb-ps/2 interrupt mode bit in the usb status and control register (see figure 13- 1 ). the details on the event conditions that set this bit are given in section 19.3. in either mode, this bit is set as soon as the event has lasted for 128 ? 256 s, and the bit will be set even if the interrupt is not enabled. the bit is only cleared by firmware or lvr/wdr. 1 = a usb reset occurred or ps/2 activity is detected, depending on usb-ps/2 interrupt select bit. 0 = no event detected since last cleared by firmware or lvr/wdr. bit 4: lvr/bor reset the low-voltage or brown-out reset is set to ? 1 ? during a power-on reset. firmware can check bits 4 and 6 in the reset handler to determine whether a reset was caused by a lvr/bor condition or a watchdog timeout. this bit is not affected by wdr. note that a lvr/bor event may be followed by a watchdog reset before firmware begins executing, as explained at the end of this section. 1 = a por or lvr has occurred. 0 = no por nor lvr since this pit last cleared. bit 3: suspend writing a '1' to the suspend bit will halt the processor and cause the microcontroller to enter the suspend mode that significa ntly reduces power consumption. an interrupt or usb bus activity will cause the device to come out of suspend. after coming out of suspend, the device will resume firmware execution at the instruction following the iowr that put the part into suspend. when writing the suspend bit with a resume condition present (such as non-idle usb activity), the suspend state will still be entered, followed immediately by the wake-up process (with appropriate delays for the clock start-up). see section 11.0 for more details on suspend mode operation. 1 = suspend the processor. 0 = not in suspend mode. cleared by the hardware when resuming from suspend. bit 2: interrupt enable sense this bit shows whether interrupts are enabled or disabled. firmware has no direct control over this bit as writing a zero or on e to this bit position will have no effect on interrupts. this bit is further gated with the bit settings of the global interrupt enable register ( figure 19-1 ) and usb endpoint interrupt enable register ( figure 19-2 ). instructions di, ei, and reti manipulate the state of this bit. 1 = interrupts are enabled. 0 = interrupts are masked off. bit 1: reserved. must be written as a 0. bit 0: run this bit is manipulated by the halt instruction. when halt is executed, the processor clears the run bit and halts at the end of the current instruction. the processor remains halted until a reset occurs (low-voltage, brown-out, or watchdog). this bit should normally be written as a ? 1 ? . during power-up, or during a low-voltage reset, the processor status and control register is set to 00010001, which indicates a lvr/bor (bit 4 set) has occurred and no interrupts are pending (bit 7 clear). note that during the t start ms partial suspend at start-up (explained in section 10.1), a watchdog reset will also occur. when a wdr occurs during the power-up suspend interval, firmware would read 01010001 from the status and control register after power-up. normally the lvr/bor bit should be cleared so that a subsequent wdr can be clearly identified. note that if a usb bus reset (long se0) is received before firmware examines this register, the bus interrupt event bit would also be set.
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 31 of 49 during a watch dog reset, the processor status and control register is set to 01xx0001, which indicates a watch dog reset (bit 4 set) has occurred and no interrupts are pending (bit 7 clear). 19.0 interrupts interrupts can be generated by the gpio lines, the internal free-running timer, on various usb events, ps/2 activity, or by the wake-up timer. all interrupts are maskable by the global interrupt enable register and the usb end point interrupt enable register. writing a ? 1 ? to a bit position enables the interrupt associated with that bit position. during a reset, the contents of the interrupt enable registers are cleared, along with the global interrupt enable bit of the cpu, effectively disabling all interr upts. the interrupt controller contains a separate flip-flop for each interrupt. see figure 19-3 for the logic block diagram of the interrupt controller. when an interrupt is generated it is first registered as a pending interrupt. it will stay pending until it is serv iced or a reset occurs. a pending interrupt will only generate an interrupt request if it is enabled by the corresponding bit in the inte rrupt enable registers. the highest priority interrupt request will be serviced following the completion of the currently executing instruction. when servicing an interrupt, the hardware will first disable all interrupts by clearing the global interrupt enable bit in the cpu (the state of this bit can be read at bit 2 of the processor status and control register). next, the flip-flop of the current interr upt is cleared. this is followed by an automatic call instruction to the rom address associated with the interrupt being serviced (i.e ., the interrupt vector, see section 19.1). the instruction in the interrupt table is typically a jmp instruction to the address o f the interrupt service routine (isr). the user can re-enable interrupts in the interrupt service routine by executing an ei instruct ion. interrupts can be nested to a level limited only by the available stack space. the program counter value and the carry and zero flags (cf, zf) are stored onto the program stack by the automatic call instruction generated as part of the interrupt acknowledge process. the user firmware is responsible for ensuring that the processor state is preserved and restored during an interrupt. the push a instruction should typically be used as the first command in the isr to save the accumulator value and the pop a instruction should be used just before the reti instruction to restore the accumulator value. the program counter, cf and zf are restored and interrupts are enabled when the reti instruction is executed. the di and ei instructions can be used to disable and enable interrupts, respectively. these instructions affect only the globa l interrupt enable bit of the cpu. if desired, ei can be used to re-enable interrupts while inside an isr, instead of waiting for the reti that exits the isr. while the global interrupt enable bit is cleared, the presence of a pending interrupt can be detected by examining the irq sense bit (bit 7 in the processor status and control register). 19.1 interrupt vectors the interrupt vectors supported by the device are listed in table 19-1 . the highest priority interrupt is #1 (usb bus reset / ps/2 activity), and the lowest priority interrupt is #11 (wake-up timer). although reset is not an interrupt, the first instruction executed after a reset is at rom address 0x0000, which corresponds to the first entry in the interrupt vector table. interrupt vectors o ccupy 2 bytes to allow for a 2-byte jmp instruction to the appropriate interrupt service routine (isr). table 19-1. interrupt vector assignments interrupt vector number rom address function not applicable 0x0000 execution after reset begins here. 1 0x0002 usb bus reset or ps/2 activity interrupt 2 0x0004 128- s timer interrupt 3 0x0006 1.024-ms timer interrupt 4 0x0008 usb endpoint 0 interrupt 5 0x000a usb endpoint 1 interrupt 6 0x000c reserved 7 0x000e reserved 8 0x0010 reserved 9 0x0012 reserved 10 0x0014 gpio interrupt 11 0x0016 wake-up timer interrupt
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 32 of 49 19.2 interrupt latency interrupt latency can be calculated from the following equation: interrupt latency = (number of clock cycles remaining in the current instruction) + (10 clock cycles for the call instruction) + (5 clock cycles for the jmp instruction) for example, if a 5-clock-cycle instruction such as jc is being executed when an interrupt occurs, the first instruction of the interrupt service routine will execute a minimum of 16 clocks (1+10+5) or a maximum of 20 clocks (5+10+5) after the interrupt is issued. with a 6 mhz external resonator, internal cpu clock speed is 12 mhz, so 20 clocks take 20/12 mhz = 1.67 s. 19.3 interrupt sources the following sections provide details on the different types of interrupt sources. bit 7: wake-up interrupt enable the internal wake-up timer is normally used to wake the part from suspend mode, but it can also provide an interrupt when the part is awake. the wake-up timer is cleared whenever the wake-up interrupt enable bit is written to a 0, and runs whenever that bit is written to a 1. when the interrupt is enabled, the wake-up timer provides periodic interrupts at multiples of perio d, as described in section 11.2. 1 = enable wake-up timer for periodic wake-up. 0 = disable and power-off wake-up timer. bit 6: gpio interrupt enable each gpio pin can serve as an interrupt input. during a reset, gpio interrupts are disabled by clearing all gpio interrupt enable registers. writing a ? 1 ? to a gpio interrupt enable bit enables gpio interrupts from the corresponding input pin. these registers are shown in figure 19-4 for port 0 and figure 19-5 for port 1. in addition to enabling the desired individual pins for interrupt, the main gpio interrupt must be enabled, as explained in section 19.0. the polarity that triggers an interrupt is controlled independently for each gpio pin by the gpio interrupt polarity registers. setting a polarity bit to ? 0 ? allows an interrupt on a falling gpio edge, while setting a polarity bit to ? 1 ? allows an interrupt on a rising gpio edge. the polarity registers reset to 0 and are shown in figure 19-6 for port 0 and figure 19-7 for port 1. all of the gpio pins share a single interrupt vector, which means the firmware will need to read the gpio ports with enabled interrupts to determine which pin or pins caused an interrupt.the gpio interrupt structure is illustrated in figure 19-8 . note that if one port pin triggered an interrupt, no other port pins can cause a gpio interrupt until that port pin has returne d to its inactive (non-trigger) state or its corresponding port interrupt enable bit is cleared. the cy7c63221/31a does not assig n interrupt priority to different port pins and the port interrupt enable registers are not affected by the interrupt acknowledge process. 1 = enable 0 = disable bit [5:3]: reserved bit 2: 1.024-ms interrupt enable the 1.024-ms interrupts are periodic timer interrupts from the free-running timer (based on the 6-mhz clock). the user should disable this interrupt before going into the suspend mode to avoid possible conflicts between servicing the timer interrupts (128- s interrupt and 1.024-ms interrupt) first or the suspend request first when waking up. 1 = enable. periodic interrupts will be generated approximately every 1.024 ms. 0 = disable. bit # 76543210 bit name wake-up interrupt enable gpio interrupt enable reserved 1.024-ms interrupt enable 128- s interrupt enable usb bus reset / ps/2 activity intr. enable read/write r/w r/w - - - r/w r/w r/w reset 00000000 figure 19-1. global interrupt enable register (address 0x20)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 33 of 49 bit 1: 128- s interrupt enable the 128- s interrupt is another source of timer interrupt from the free-running timer. the user should disable both timer interrupts (128- s and 1.024-ms) before going into the suspend mode to avoid possible conflicts between servicing the timer interrupts first or the suspend request first when waking up. 1 = enable. periodic interrupts will be generated approximately every 128 s. 0 = disable. bit 0: usb bus reset - ps/2 interrupt enable the function of this interrupt is selectable between detection of either a usb bus reset condition, or ps/2 activity. the selec tion is made with the usb-ps/2 interrupt mode bit in the usb status and control register ( figure 13-1 ). in either case, the interrupt will occur if the selected condition exists for 256 s, and may occur as early as 128 s. a usb bus reset is indicated by a single-ended zero (se0) on the usb d+ and d ? pins. the usb bus reset interrupt occurs when the se0 condition ends. ps/2 activity is indicated by a continuous low on the sdata pin. the ps/2 interrupt occurs as soon as the long low state is detected. during the entire interval of a usb bus reset or ps/2 interrupt event, the usb device address register is cleared. the bus reset/ps/2 interrupt may occur 128 s after the bus condition is removed. 1 = enable 0 = disable bit [7:3]: reserved. bit [2:1]: ep1 interrupt enable the non-control endpoint interrupt (ep1) is generated when:  the usb host writes valid data to an endpoint fifo. however, if the endpoint is in ack out modes, an interrupt is generated regardless of data packet validity (i.e., good crc). firmware must check for data validity.  the device sie sends a nak or stall handshake packet to the usb host during the host attempts to read data from the endpoint (ins).  the device receives an ack handshake after a successful read transaction (in) from the host.  the device sie sends a nak or stall handshake packet to the usb host during the host attempts to write data (outs) to the endpoint fifo. 1 = enable 0 = disable refer to table 20-1 for more information. bit 0: ep0 interrupt enable if enabled, the control endpoint interrupt is generated when:  the endpoint 0 mode is set to accept a setup token.  after the sie sends a 0 byte packet in the status stage of a control transfer.  the usb host writes valid data to an endpoint fifo. however, if the endpoint is in ack out modes, an interrupt is generated regardless of what data is received. firmware must check for data validity.  the device sie sends a nak or stall handshake packet to the usb host during the host attempts to read data from the endpoint (ins).  the device sie sends a nak or stall handshake packet to the usb host during the host attempts to write data (outs) to the endpoint fifo. 1 = enable ep0 interrupt 0 = disable ep0 interrupt bit # 76543210 bit name reserved ep1 interrupt enable ep0 interrupt enable read/write ------r/wr/w reset 00000000 figure 19-2. endpoint interrupt enable register (address 0x21)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 34 of 49 bit [7:0]: p0 [7:0] interrupt enable 1 = enables gpio interrupts from the corresponding input pin. 0 = disables gpio interrupts from the corresponding input pin. bit [7:0]: p1 [7:0] interrupt enable 1 = enables gpio interrupts from the corresponding input pin. 0 = disables gpio interrupts from the corresponding input pin. figure 19-3. interrupt controller logic block diagram bit # 76543210 bit name p0 interrupt enable read/write wwwwwwww reset 00000000 figure 19-4. port 0 interrupt enable register (address 0x04) bit # 76543210 bit name reserved p1[1:0] interrupt enable read/write ------ww reset 00000000 figure 19-5. port 1 interrupt enable register (address 0x05) clr global interrupt interrupt acknowledge irqout usb-ps/2 clear interrupt interrupt priority encoder enable [0] d q 1 enable bit clr usb-ps/2 irq 128- s clr 128- s irq 1-ms clr 1-ms irq ep0 irq ep0 clr wake-up irq vector enable [7] clk clr d q clk 1 wake-up clr int wake-up int usb- irq pending irq controlled by di, ei, and reti instructions to cpu cpu ps/2 gpio irq gpio clr ep1 irq ep1 clr (reg 0x20) (reg 0x20) clr enable [1] d q 1 clk int ep1 (reg 0x21) int enable sense (bit 7, reg 0xff) (bit 2, reg 0xff)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 35 of 49 the polarity that triggers an interrupt is controlled independently for each gpio pin by the gpio interrupt polarity registers. figure 19-6 and figure 19-7 control the interrupt polarity of each gpio pin. bit [7:0]: p0[7:0] interrupt polarity 1 = rising gpio edge 0 = falling gpio edge bit [7:0]: p1[7:0] interrupt polarity 1 = rising gpio edge 0 = falling gpio edge bit # 76543210 bit name p0 interrupt polarity read/write wwwwwwww reset 00000000 figure 19-6. port 0 interrupt polarity register (address 0x06) bit # 76543210 bit name reserved p1[1:0] interrupt polarity read/write ------ww reset 00000000 figure 19-7. port 1 interrupt polarity register (address 0x07) figure 19-8. gpio interrupt diagram port bit interrupt or gate gpio interrupt flip flop clr gpio pin 1 = enable 0 = disable port bit interrupt enable register 1 = enable 0 = disable interrupt priority encoder irqout interrupt vector d q m u x 1 (1 input per gpio pin) global gpio interrupt enable (bit 6, register 0x20) ira polarity register
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 36 of 49 20.0 usb mode tables the following tables give details on mode setting for the usb serial interface engine (sie) for both the control endpoint (ep0) and non-control endpoint (ep1). note: 3. stall bit is the bit 7 of the usb non-control device endpoint mode registers. refer to section 14.3 for more explanation. mode column: the ? mode ? column contains the mnemonic names given to the modes of the endpoint. the mode of the endpoint is determined by the 4 bit binaries in the ? encoding ? column as discussed below. the status in and status out modes represent the status in or out stage of the control transfer. encoding column: the contents of the ? encoding ? column represent the mode bits [3:0] of the endpoint mode registers ( figure 14-2 and figure 14- 3 ). the endpoint modes determine how the sie responds to different tokens that the host sends to the endpoints. for example, if the mode bits [3:0] of the endpoint 0 mode register ( figure 14-2 ) are set to ? 0001 ? , which is nak in/out mode as shown in table 20-1 above, the sie of the part will send an ack handshake in response to setup tokens and nak any in or out tokens. for more information on the functionality of the serial interface engine (sie), see section 13.0. setup, in, and out columns: depending on the mode specified in the ? encoding ? column, the ? setup ? , ? in ? , and ? out ? columns contain the device sie ? s responses when the endpoint receives setup, in, and out tokens respectively. a ? check ? in the out column means that upon receiving an out token the sie checks to see whether the out is of zero length and has a data toggle (data1/0) of 1. if these conditions are true, the sie responds with an ack. if any of the above condition s is not met, the sie will respond with either a stall or ignore. table 20-3 gives detailed analysis of all possible cases. a ? tx count ? entry in the in column means that the sie will transmit the number of bytes specified in the byte count bit [3:0] of the endpoint count register ( figure 14-4 ) in response to any in token. table 20-1. usb register mode encoding for control and non-control endpoint mode encoding setup in out comments disable 0000 ignore ignore ignore ignore all usb traffic to this endpoint nak in/out 0001 accept nak nak on control endpoint, after successfully sending an ack handshake to a setup packet, the sie forces the endpoint mode (from modes other than 0000) to 0001. the mode is also changed by the sie to 0001 from mode 1011 on issuance of ack handshake to an out. status out only 0010 accept stall check for control endpoints stall in/out 0011 accept stall stall for control endpoints ignore in/out 0100 accept ignore ignore for control endpoints reserved 0101 ignore ignore always reserved status in only 0110 accept tx 0 byte stall for control endpoints reserved 0111 ignore tx count ignore reserved nak out 1000 ignore ignore nak in mode 1001, after sending an ack handshake to an out, the sie changes the mode to 1000 ack out( stall [3] = 0) ack out (stall [3] = 1) 1001 1001 ignore ignore ignore ignore ack stall this mode is changed by the sie to mode 1000 on issuance of ack handshake to an out nak out - status in 1010 accept tx 0 byte nak ack out - nak in 1011 accept nak ack this mode is changed by the sie to mode 0001 on issuance of ack handshake to an out nak in 1100 ignore nak ignore an ack from mode 1101 changes the mode to 1100 ack in (stall [3] =0) ack in( stall [3] =1) 1101 1101 ignore ignore tx count stall ignore ignore this mode is changed by the sie to mode 1100 on issuance of ack handshake to an in nak in - status out 1110 accept nak check an ack from mode 1111 changes the mode to 1110 ack in - status out 1111 accept tx count check this mode is changed by the sie to mode 1110 on issuance of ack handshake to an in
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 37 of 49 a ? tx 0 byte ? entry in the in column means that the sie will transmit a zero byte packet in response to any in sent to the endpoint. sending a 0 byte packet is to complete the status stage of a control transfer. an ? ignore ? means that the device sends no handshake tokens. an ? accept ? means that the sie will respond with an ack to a valid setup transaction. comments column: some mode bits are automatically changed by the sie in response to many usb transactions. for example, if the mode bits [3:0] are set to ? 1111 ? which is ack in-status out mode as shown in table 20-1 , the sie will change the endpoint mode bits [3:0] to nak in-status out mode (1110) after acking a valid status stage out token. the firmware needs to update the mode for the sie to respond appropriately. see table 20-1 for more details on what modes will be changed by the sie. any setup packet to an enabled endpoint with mode set to accept setups will be changed by the sie to 0001 (naking). any mode set to accept a setup will send an ack handshake to a valid setup token. a disabled endpoint will remain disabled until changed by firmware, and all endpoints reset to the disabled mode (0000). firmwa re normally enables the endpoint mode after a setconfiguration request. the control endpoint has three status bits for identifying the token type received (setup, in, or out), but the endpoint must b e placed in the correct mode to function as such. non-control endpoint should not be placed into modes that accept setups.
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 38 of 49 the response of the sie can be summarized as follows: 1. the sie will only respond to valid transactions, and will ignore non-valid ones. 2. the sie will generate an interrupt when a valid transaction is completed or when the fifo is corrupted. fifo corruption occur s during an out or setup transaction to a valid internal address, that ends with a non-valid crc. 3. an incoming data packet is valid if the count is < endpoint size + 2 (includes crc) and passes all error checking; 4. an in will be ignored by an out configured endpoint and visa versa. 5. the in and out pid status is updated at the end of a transaction. 6. the setup pid status is updated at the beginning of the data packet phase. 7. the entire endpoint 0 mode register and the count register are locked to cpu writes at the end of any transaction to that endpoint in which an ack is transferred. these registers are only unlocked by a cpu read of these registers, and only if that read happens after the transaction completes. this represents about a 1- s window in which the cpu is locked from register writes to these usb registers. normally the firmware should perform a register read at the beginning of the endpoint isrs to unlock and get the mode register information. the interlock on the mode and count registers ensures that the firmware recognizes the changes that the sie might have made during the previous transaction. table 20-2. decode table for table 20-3 : ? details of modes for differing traffic conditions ? endpoint mode encoding properties of incoming packet changes to the internal register made by the sie as a result of the incoming token interrupt? end point mode 3 2 1 0 token count buffer dval dtog dval count setup in out ack 3 2 1 0 response int bit[3:0], figure 14-4 sie ? s response data valid (bit 6, figure 14-4 ) endpoint mode changed by the sie. data 0/1 (bit 7, figure 14-4 ) received token (setup, in,out) the validity of the received data acknowledge transaction completed (bit4, figure 14-2 /3) the quality status of the dma buffer pid status bits (bit[7:5], figure 14-2 ) the number of received bytes legend: uc: unchanged tx: transmit tx0: transmit 0-length packet x: don ? t care rx: receive available for control endpoint only
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 39 of 49 table 20-3. details of modes for differing traffic conditions end point mode pid set end point mode 3210 rcved token count buffer dval dtog dval count setup in out ack 3 2 1 0 response int setup packet (if accepting) see20-1 setup <= 10 data valid updates 1 updates 1 uc uc 1 0 0 0 1 ack yes see20-1 setup > 10 junk x updates updates updates 1 uc uc uc nochange ignore yes see 20-1 setup x junk invalid updates 0 updates 1 uc uc uc nochange ignore yes disabled 0 0 0 0 x x uc x uc uc uc uc uc uc uc nochange ignore no nak in/out 0 0 0 1 out x uc x uc uc uc uc uc 1 uc nochange nak yes 0 0 0 1 out > 10 uc x uc uc uc uc uc uc uc nochange ignore no 0 0 0 1 out x uc invalid uc uc uc uc uc uc uc nochange ignore no 0 0 0 1 in x uc x uc uc uc uc 1 uc uc nochange nak yes ignore in/out 0 1 0 0 out x uc x uc uc uc uc uc uc uc nochange ignore no 0 1 0 0 in x uc x uc uc uc uc uc uc uc nochange ignore no stall in/out 0 0 1 1 out x uc x uc uc uc uc uc 1 uc nochange stall yes 0 0 1 1 out > 10 uc x uc uc uc uc uc uc uc nochange ignore no 0 0 1 1 out x uc invalid uc uc uc uc uc uc uc nochange ignore no 0 0 1 1 in x uc x uc uc uc uc 1 uc uc nochange stall yes control write ack out/nak in 1 0 1 1 out <= 10 data valid updates 1 updates uc uc 1 1 0 0 0 1 ack yes 1 0 1 1 out > 10 junk x updates updates updates uc uc 1 uc nochange ignore yes 1 0 1 1 out x junk invalid updates 0 updates uc uc 1 uc nochange ignore yes 1 0 1 1 in x uc x uc uc uc uc 1 uc uc nochange nak yes nak out/status in 1 0 1 0 out <= 10 uc valid uc uc uc uc uc 1 uc nochange nak yes 1 0 1 0 out > 10 uc x uc uc uc uc uc uc uc nochange ignore no 1 0 1 0 out x uc invalid uc uc uc uc uc uc uc nochange ignore no 1 0 1 0 in x uc x uc uc uc uc 1 uc 1 nochange tx 0 byte yes status in only 0 1 1 0 out <= 10 uc valid uc uc uc uc uc 1 uc 0 0 1 1 stall yes 0 1 1 0 out > 10 uc x uc uc uc uc uc uc uc nochange ignore no 0 1 1 0 out x uc invalid uc uc uc uc uc uc uc nochange ignore no 0 1 1 0 in x uc x uc uc uc uc 1 uc 1 nochange tx 0 byte yes control read ack in/status out 1 1 1 1 out 2 uc valid 1 1 updates uc uc 1 1 nochange ack yes 1 1 1 1 out 2 uc valid 0 1 updates uc uc 1 uc 0 0 1 1 stall yes 1 1 1 1 out !=2 uc valid updates 1 updates uc uc 1 uc 0 0 1 1 stall yes 1 1 1 1 out > 10 uc x uc uc uc uc uc uc uc nochange ignore no 1 1 1 1 out x uc invalid uc uc uc uc uc uc uc nochange ignore no 1 1 1 1 in x uc x uc uc uc uc 1 uc 1 1 1 1 0 ack (back) yes nak in/status out 1 1 1 0 out 2 uc valid 1 1 updates uc uc 1 1 nochange ack yes 1 1 1 0 out 2 uc valid 0 1 updates uc uc 1 uc 0 0 1 1 stall yes 1 1 1 0 out !=2 uc valid updates 1 updates uc uc 1 uc 0 0 1 1 stall yes 1 1 1 0 out > 10 uc x uc uc uc uc uc uc uc nochange ignore no
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 40 of 49 3 2 1 0 token count buffer dval dtog dval count setup in out ack 3 2 1 0 response int 1 1 1 0 out x uc invalid uc uc uc uc uc uc uc nochange ignore no 1 1 1 0 in x uc x uc uc uc uc 1 uc uc nochange nak yes status out only 0 0 1 0 out 2 uc valid 1 1 updates uc uc 1 1 nochange ack yes 0 0 1 0 out 2 uc valid 0 1 updates uc uc 1 uc 0 0 1 1 stall yes 0 0 1 0 out !=2 uc valid updates 1 updates uc uc 1 uc 0 0 1 1 stall yes 0 0 1 0 out > 10 uc x uc uc uc uc uc uc uc nochange ignore no 0 0 1 0 out x uc invalid uc uc uc uc uc uc uc nochange ignore no 0 0 1 0 in x uc x uc uc uc uc 1 uc uc 0 0 1 1 stall yes out endpoint ack out, stall bit = 0 ( figure 14-3 ) 1 0 0 1 out <= 10 data valid updates 1 updates uc uc 1 1 1 0 0 0 ack yes 1 0 0 1 out > 10 junk x updates updates updates uc uc 1 uc nochange ignore yes 1 0 0 1 out x junk invalid updates 0 updates uc uc 1 uc nochange ignore yes 1 0 0 1 in x uc x uc uc uc uc uc uc uc nochange ignore no ack out, stall bit = 1 ( figure 14-3 ) 1 0 0 1 out <= 10 uc valid uc uc uc uc uc 1 uc nochange stall yes 1 0 0 1 out > 10 uc x uc uc uc uc uc uc uc nochange ignore no 1 0 0 1 out x uc invalid uc uc uc uc uc uc uc nochange ignore no 1 0 0 1 in x uc x uc uc uc uc uc uc uc nochange ignore no nak out 1 0 0 0 out <= 10 uc valid uc uc uc uc uc 1 uc nochange nak yes 1 0 0 0 out > 10 uc x uc uc uc uc uc uc uc nochange ignore no 1 0 0 0 out x uc invalid uc uc uc uc uc uc uc nochange ignore no 1 0 0 0 in x uc x uc uc uc uc uc uc uc nochange ignore no reserved 0 1 0 1 out x updates updates updates updates updates uc uc 1 1 nochange rx yes 0 1 0 1 in x uc x uc uc uc uc uc uc uc nochange ignore no in endpoint ack in, stall bit = 0 ( figure 14-3 ) 1 1 0 1 out x uc x uc uc uc uc uc uc uc nochange ignore no 1 1 0 1 in x uc x uc uc uc uc 1 uc 1 1 1 0 0 ack (back) yes ack in, stall bit = 1 ( figure 14-3 ) 1 1 0 1 out x uc x uc uc uc uc uc uc uc nochange ignore no 1 1 0 1 in x uc x uc uc uc uc 1 uc uc nochange stall yes nak in 1 1 0 0 out x uc x uc uc uc uc uc uc uc nochange ignore no 1 1 0 0 in x uc x uc uc uc uc 1 uc uc nochange nak yes reserved 0 1 1 1 out x uc x uc uc uc uc uc uc uc nochange ignore no 0 1 1 1 in x uc x uc uc uc uc 1 uc uc nochange tx yes table 20-3. details of modes for differing traffic conditions (continued)
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 41 of 49 21.0 register summary address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 read/write)/ both(b) default/ reset gpio configuration ports 0, 1, and 2 0x00 port 0 data p0 bbbbbbbb 00000000 0x01 port 1 data reserved p1[1:0] ------ bb 00000000 0x02 port 2 data reserved d+(sclk) state d- (sdata) state reserved p2.2(int clk mode only) p2.1 (int clk mode only) p2.0 vreg pin state -- rr - rrr 00000000 0x0a gpio port 0 mode 0 p0[7:0] mode0 wwwwwwww 00000000 0x0b gpio port 0 mode 1 p0[7:0] mode1 wwwwwwww 00000000 0x0c gpio port 1 mode 0 reserved p1[1:0] mode0 ------ ww 00000000 0x0d gpio port 1 mode 1 reserved p1[1:0] mode1 ------ ww 00000000 0x04 port 0 interrupt enable p0[7:0] interrupt enable wwwwwwww 00000000 0x05 port 1 interrupt enable reserved p1[1:0] interrupt enable ------ ww 00000000 0x06 port 0 interrupt polarity p0[7:0] interrupt polarity wwwwwwww 00000000 0x07 port 1 interrupt polarity reserved p1[1:0] interrupt polarity ------ ww 00000000 clock config. 0xf8 clock configuration ext. clock resume delay wake-up timer adjust bit [2:0] low voltage reset disable precision usb clocking enable internal clock output disable external oscillator enable bbbbbbbb 00000000 endpoint 0, i and 2 configuration 0x10 usb device address device address enable device address bbbbbbbb 00000000 0x12 ep0 mode setup received in received out received acked transaction mode bit bbbbbbbb 00000000 0x14 ep1 mode register stall reserved acked transaction mode bit b -- bbbbb 00000000 0x11, 0x13 ep0 and 1counter data 0/1 toggle data valid reserved byte count bb -- bbbb 00000000 usb- sc 0x1f usb status and control ps/2 pull- up enable vreg enable usb reset- ps/2 activity interrupt mode reserved usb bus activity d+/d- forcing bit bbb - bbbb 00000000 interrupt 0x20 global interrupt enable wake-up interrupt enable gpio interrupt enable reserved 1.024 ms interrupt enable 128 s interrupt enable usb bus reset-ps/2 activity intr. enable bb --- bbb 00000000 0x21 endpoint interrupt enable reserved ep1 interrupt enable ep0 interrupt enable ------ bb 00000000 timer 0x24 timer lsb timer bit [7:0] rrrrrrrr 00000000 0x25 timer (msb) reserved timer bit [11:8] ---- rrrr 00000000 proc sc. 0xff process status & control irq pending watch dog reset bus interrupt event lvr/bor reset suspend interrupt enable sense reserved run rbbbbr - b see section 18.0
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 42 of 49 22.0 absolute maximum ratings storage temperature ........................................................................................................... ............................... ? 65 c to +150 c ambient temperature with power applied ......................................................................................... ...................... ? 0 c to +70 c supply voltage on v cc relative to v ss .................................................................................................................... ? 0.5v to +7.0v dc input voltage............................................................................................................... ............................ ? 0.5v to +v cc +0.5v dc voltage applied to outputs in high z state.................................................................................. .......... ? 0.5v to + v cc +0.5v maximum total sink output current into port 0 and 1 and pins................................................................... ....................... 70 ma maximum total source output current into port 0 and 1 and pins ................................................................. .................... 30 ma maximum on-chip power dissipation on any gpio pin .............................................................................. ........................50 mw power dissipation .............................................................................................................. ................................................300 mw static discharge voltage ...................................................................................................... ............................................. >2000v latch-up current .............................................................................................................. ............................................... >200 ma 23.0 dc characteristics f osc = 6 mhz; operating temperature = 0 to 70 c parameter min max units conditions general v cc1 operating voltage v lvr 5.5 v note 4 v cc2 operating voltage 4.35 5.25 v note 4 i cc1 v cc operating supply current - internal oscillator mode. typical i cc1 = 16 ma [5] 20 ma v cc = 5.5v, no gpio loading v cc = 5.0v. t = room temperature i cc2 v cc operating supply current - external oscillator mode. typical i cc2 = 13 ma [5] 17 ma v cc = 5.5v, no gpio loading v cc = 5.0v. t = room temperature i sb1 standby current - no wake-up osc 25 a oscillator off, d ? > 2.7v i sb2 standby current - with wake-up osc 75 a oscillator off, d ? > 2.7v v pp programming voltage (disabled) ? 0.4 0.4 v t rsntr resonator start-up interval 256 sv cc = 5.0v, ceramic resonator i il input leakage current 1 a any i/o pin i snk max i ss gpio sink current 70 ma cumulative across all ports [6] i src max i cc gpio source current 30 ma cumulative across all ports [6] low-voltage and power-on reset v lvr low-voltage reset trip voltage 3.5 4.0 v v cc below v lvr for >100 ns [7] t vccs v cc power-on slew time 100 ms linear ramp: 0 to 4v [8] usb interface v reg vreg regulator output voltage 3.0 3.6 v load = r pu +r pd [9, 10] c reg capacitance on vreg pin 300 pf external cap not required v ohu static output high, driven 2.8 3.6 v r pd to gnd [4] v olu static output low 0.3 v with r pu to vreg pin v ohz static output high, idle or suspend 2.7 3.6 v r pd connected d ? to gnd, r pu connected d ? to vreg pin [4] notes: 4. full functionality is guaranteed in v cc1 range, except usb transmitter specifications and gpio output currents are guaranteed for v cc2 range. 5. bench measurements taken under nominal operating conditions. spec cannot be guaranteed at final test. 6. total current cumulative across all port pins, limited to minimize power and ground-drop noise effects. 7. lvr is automatically disabled during suspend mode. 8. lvr will re-occur whenever v cc drops below v lvr . in suspend or with lvr disabled, bor occurs whenever v cc drops below approximately 2.5v. 9. v rg specified for regulator enabled, idle conditions (i.e., no usb traffic), with load resistors listed. during usb transmits from the internal sie, the vreg output is not regulated, and should not be used as a general source of regulated voltage in that case. during receive of usb da ta, the vreg output drops when d ? is low due to internal series resistance of approximately 200 ? at the vreg pin. 10. in suspend mode, v rg is only valid if r pu is connected from d ? to vreg pin, and r pd is connected from d ? to ground
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 43 of 49 note: 11. the 200 ? internal resistance at the vreg pin gives a standard usb pull-up using this value. alternately, a 1.5 k ? , 5% pull-up from d ? to an external 3.3v supply can be used. v di differential input sensitivity 0.2 v |(d+) ? (d ? )| v cm differential input common mode range 0.8 2.5 v v se single ended receiver threshold 0.8 2.0 v c in transceiver capacitance 20 pf i lo hi-z state data line leakage ? 10 10 a0 v < v in <3.3 v (d+ or d ? pins) r pu external bus pull-up resistance (d ? ) 1.274 1.326 k ? 1.3 k ? 2% to vreg [11] r pd external bus pull-down resistance 14.25 15.75 k ? 15 k ? 5% to gnd ps/2 interface v olp static output low 0.4 v isink = 5 ma, sdata or sclk pins r ps2 internal ps/2 pull-up resistance 3 7 k ? sdata, sclk pins, ps/2 enabled general purpose i/o interface r up pull-up resistance 8 24 k ? v icr input threshold voltage, cmos mode 40% 60% v cc low to high edge, port 0 or 1 v icf input threshold voltage, cmos mode 35% 55% v cc high to low edge, port 0 or 1 v hc input hysteresis voltage, cmos mode 3% 10% v cc high to low edge, port 0 or 1 v ittl input threshold voltage, ttl mode 0.8 2.0 v ports 0, 1, and 2 v ol1a v ol1b output low voltage, high drive mode 0.8 0.4 v v i ol1 = 50 ma, ports 0 or 1 [4] i ol1 = 25 ma, ports 0 or 1 [4] v ol2 output low voltage, medium drive mode 0.4 v i ol2 = 8 ma, ports 0 or 1 [4] v ol3 output low voltage, low drive mode 0.4 v i ol3 = 2 ma, ports 0 or 1 [4] v oh output high voltage, strong drive mode v cc ? 2 v port 0 or 1, i oh = 2 ma [4] r xin pull-down resistance, xtalin pin 50 k ? internal clock mode only parameter min max units conditions
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 44 of 49 24.0 switching characteristics notes: 12. initially f iclk2 =f iclk until a usb packet is received. 13. wake-up time for wake-up adjust bits cleared to 000b (minimum setting) 14. tested at 200 pf. 15. measured at cross-over point of differential data signals. 16. non-usb mode refers to driving the d ? /sdata and/or d+/sclk pins with the control bits of the usb status and control register, with control bit 2 high. 17. per the usb 2.0 specification, table 7.7, note 10, the first transition from the idle state is excluded. parameter description min. max. unit conditions internal clock mode f iclk internal clock frequency 5.7 6.3 mhz internal clock mode enabled f iclk2 internal clock frequency, usb mode 5.91 6.09 mhz internal clock mode enabled, bit 2 of register 0xf8h is set (precision usb clocking) [12] external oscillator mode t cyc input clock cycle time 164.2 169.2 ns usb operation, with external 1.5% ceramic resonator or crystal t ch clock high time 0.45 t cyc ns t cl clock low time 0.45 t cyc ns reset timing t start time-out delay after lvr/bor 24 60 ms t wake internal wake-up period 1 5 ms enabled wake-up interrupt [13] t watch watchdog timer period 10.1 14.6 ms f osc = 6 mhz usb driver characteristics t r transition rise time 75 ns cload = 200 pf (10% to 90% [4] ) t r transition rise time 300 ns cload = 600 pf (10% to 90% [4] ) t f transition fall time 75 ns cload = 200 pf (10% to 90% [4] ) t f transition fall time 300 ns cload = 600 pf (10% to 90% [4] ) t rfm rise/fall time matching 80 125 % t r /t f [4, 14] v crs output signal crossover voltage [17] 1.3 2.0 v cload = 200 to 600 pf [4] usb data timing t drate low speed data rate 1.4775 1.5225 mb/s ave. bit rate (1.5 mb/s 1.5%) t djr1 receiver data jitter tolerance ? 75 75 ns to next transition [15] t djr2 receiver data jitter tolerance ? 45 45 ns for paired transitions [15] t deop differential to eop transition skew ? 40 100 ns note 15 t eopr2 eop width at receiver 670 ns accepts as eop [15] t eopt source eop width 1.25 1.50 s t udj1 differential driver jitter ? 95 95 ns to next transition, figure 24-5 t udj2 differential driver jitter ? 150 150 ns to paired transition, figure 24-5 t lst width of se0 during diff. transition 210 ns non-usb mode driver characteristics note 16 t fps2 sdata / sck transition fall time 50 300 ns cload = 150 pf to 600 pf
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 45 of 49 . figure 24-1. clock timing figure 24-2. usb data signal timing figure 24-3. receiver jitter tolerance clock t cyc t cl t ch 90% 10% 90% 10% d ? d + t r t f v crs v oh v ol differential data lines paired transitions n * t period + t jr2 t period consecutive transitions n * t period + t jr1 t jr t jr1 t jr2
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 46 of 49 figure 24-4. differential to eop transition skew and eop width figure 24-5. differential data jitter t period differential data lines crossover point crossover point extended source eop width: t eopt receiver eop width: t eopr1 , t eopr2 diff. data to se0 skew n * t period + t deop t period differential data lines crossover points paired transitions n * t period + t xjr2 consecutive transitions n * t period + t xjr1
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 47 of 49 26.0 package diagrams 25.0 ordering information ordering code eprom size package name package type operating range cy7c63221a-pc 3 kb p1 16-pin (300-mil) pdip commercial cy7c63231a-sc 3 kb s1 18-pin small outline package commercial CY7C63231-PC 3 kb p3 18-pin (300-mil) pdip commercial cy7c63221a-xc 3 kb - 18-pad die form commercial 51-85009-a 16-lead (300-mil) molded dip p1 16-lead (300-mil) molded soic s1 51-85022-a
encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 48 of 49 ? cypress semiconductor corporation, 2001. the information contained herein is subject to change without notice. cypress semico nductor corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a cypress semiconductor product. nor does it convey or imply any license unde r patent or other rights. cypress semiconductor does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected t o result in significant injury to the user. the inclusion of cypress semiconductor products in life-support systems application implies that the manufacturer assumes all risk of such use and in do ing so indemnifies cypress semiconductor against all charges. table 26-1 below shows the die pad coordinates for the cy7c63221a-xc. the center location of each bond pad is relative to the center of the die which has coordinate (0,0) as shown above. encore is a trademark of cypress semiconductor corporation. all product and company names mentioned in this document may be the trademarks of their respective holders. table 26-1. cy7c63221a-xc probe pad coordinates in microns ((0,0) to bond pad centers) pad number pin name x (microns) y (microns) 1p0.0 ? 351.75 995.00 2p0.1 ? 543.20 995.00 3p0.2 ? 734.65 995.00 4p0.3 ? 861.05 779.25 5p1.0 ? 861.05 587.80 6vss ? 861.05 ? 949.65 7vpp ? 468.20 ? 968.10 8vreg ? 300.40 ? 968.10 9 xtalin 63.30 ? 968.10 10 xtalout 207.50 ? 968.10 11 vcc 594.60 ? 968.10 12 d ? 771.35 ? 968.10 13 d+ 844.05 ? 863.10 14 p1.1 861.05 581.95 15 p0.7 861.05 773.95 16 p0.6 720.15 995.00 17 p0.5 528.70 995.00 18 p0.4 337.25 995.00 51-85010-a 18-lead (300-mil) molded dip p3 die form 4 5 3 1 2 17 16 15 14 7 8 9 10 11 12 13 6 18 (0,0) cypress logo x y die step: 2031.0 x 2279.0 microns pad size: 80 x 80 microns
for for encore ? usb cy7c63221/31a document #: 38-08028 rev. *a page 49 of 49 document history page document title: cy7c63221/31a encore ? low-speed usb peripheral controller document number: 38-08028 rev. ecn no. issue date orig. of change description of change ** 116226 06/17/02 dsg change from spec number: 38-01049 to 38-08028 *a 116976 10/23/02 bon reformat. add note 5 to 24.0. add die sale, section 21.0. change figure 9-1


▲Up To Search▲   

 
Price & Availability of CY7C63231-PC

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X